【发布时间】:2015-07-29 11:28:14
【问题描述】:
所以我有以下 ElasticSearch 查询:
"query": {
"bool": {
"must": [
{
"nested": {
"path": "specs",
"query": {
"bool": {
"must": [
{
"match": {
"specs.battery": "2 hours"
}
}
],
"minimum_should_match": 1
}
}
}
},
{
"terms": {
"category_ids": [
16405
]
}
}
]
}
}
目前它返回所有在specs.battery 值中具有2 或hours 的文档。如何修改此查询,使其仅返回在 specs.battery 字段中具有精确短语 2 hours 的文档?同样,我希望能够拥有多个短语(2 小时、2 小时、3 小时等)。这可以实现吗?
【问题讨论】:
-
specs.battery 是否定义为“not_analyzed”?
标签: elasticsearch