如果我運行下面有AND
查詢返回什麼:彈性搜索和運營商不沃金
TF1:"rohan sharma" AND TF3:"gaurav"
,但如果我用OR
其返回結果:
TF1:"rohan sharma" OR TF3:"gaurav"
兩個數據是可用的
這裏是映射:
{
"TEST": {
"mappings": {
"indextestField1": {
"_ttl": {
"enabled": true
},
"properties": {
"TF1": {
"type": "string"
},
"TF2": {
"type": "string"
}
}
}
}
}
}
這裏是我的Java代碼
SearchResponse response = client.prepareSearch("TEST")
.setQuery(QueryBuilders.queryString("TF1:\"rohan sharma\" AND TF2:\"milind bagal\""))
.execute()
.actionGet();
不要更改爲「OR」運算符,請嘗試單獨運行每個子句,並確保您正在查找的文檔出現在兩者中。也就是說,嘗試使用TF1:\「rohan sharma \」「'和'」TF2:\「milind bagal \」「'作爲您的查詢字符串,確保您正在查找的文檔包含* both * 。 – femtoRgon 2014-08-30 19:32:25