我试图建立这个查询一点点.我正在搜索的索引还有一个带有id的字段"entity".因此,一些记录将具有"实体":16,"实体"156等,具体取决于实体的ID.我需要以这样的方式扩展此查询:我可以传递一个数组或一些值列表,例如{:term => {:entity => [1,16,100]}}并获取具有的记录其中一个整数作为它们的实体值.到目前为止我没有运气,有人可以帮帮我吗?
{
"query" : {
"bool" : {
"must" : [
{
"term" : {"user_type" : "alpha"}
},
{
"term" :{"area" : "16"}
}
],
"must_not" : [],
"should" : []
}
},
"filter": {
"or" : [{
"and" : [
{ "term" : { "area" : "16" } },
{ "term" : { "date" : "05072013" } }
]
}, {
"and" : [
{ "term" : { "area" : "16" } },
{ "term" : { "date" : "blank" } }
]
}
]
},
"from" : 0,
"size" : 100
}
Run Code Online (Sandbox Code Playgroud)
mbj*_*mbj 31
用"terms"而不是"term".
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-filter.html
{ "terms" : { "entity" : [ 123, 1234, ... ] }}
| 归档时间: |
|
| 查看次数: |
18620 次 |
| 最近记录: |