首先,我将跟随位于here的elastic search教程。我正在尝试使用多个查询字符串执行搜索。
我的索引有几个字段,但我感兴趣的是"path“。
我知道我至少有这条路
path: "ops/TopRelation/...."在我的索引里。我已经证实了这一点。
为什么这个查询不会返回任何东西。
{
"query":{
"match":{
"path":{
"query": "ops toprelation",
"operator": "and"
}
}
}
}但是这个查询返回了我期望的结果。
{
"query": {
"bool": {
"must": [
{ "match": { "path": "ops" }},
{ "match": { "path": "toprelation" }}
]
}
}
}我以为top查询基本上就是内部使用了bottom查询的查询?实际上,本教程中的示例似乎表明了this。
Because the match query has to look for two terms — ["brown","dog"] — internally it
has to execute two term queries and combine their individual results into the overall
result. To do this, it wraps the two term queries in a bool query, which we will
examine in detail in Combining queries below.发布于 2014-10-01 03:38:35
如果在"operator“中使用"or”而不是"and“,是否会返回任何结果?
您能分享一下该索引的映射吗?
GET <IndeName>/<Type>/_mappinghttps://stackoverflow.com/questions/26126808
复制相似问题