簡體   English   中英

elasticsearch必須多值搜索

[英]elasticsearch must multivalue search

我的elasticsearch版本是2.4,

在對must子句使用多值搜索時遇到問題。 在下面的elasticsearch查詢中,我搜索查詢“ polo tshirt”和國家/地區“ us”

但是它沒有提供查詢“ polo tshirt”的相關數據。

curl -XGET 'localhost:9200/_search?pretty' -H 'Content-Type: application/json' -d'
{
    "query" : {                     
        "bool" : {
            "must" : {
                "match" :{
                    "common" : {
                        "_all" : {
                            "query" : "polo tshirt",                                            
                            "minimum_should_match" : '100%'
                        }
                    }
                },
                "match" : { "country" : "us"}
            }                           
        }
    },
    "sort" : [
    {"review" :{"order" :"desc"}}
    ]     
}'

必須與[]一起使用。

 {
"query": {
    "bool": {
        "must": [{
            "common": {
                "_all": {
                    "query": "polo tshirt",
                    "minimum_should_match": "100%"
                }
            }
        }, {
            "match": {
                "country": "us"
            }

        }]
    }
},
"sort": [{
    "review": {
        "order": "desc"
    }
}]
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM