【发布时间】:2018-03-10 07:37:27
【问题描述】:
我需要过滤一个 ES 查询,其中日期字段的值为 LTE 给定值或该字段完全缺失。这是我此时的查询:
{
"from":0,
"size":50,
"query":{
"bool":{
"filter":[
{
"term":{
"corpusid.string.as_is":"42:6:4"
}
},
{
"nested":{
"path":"category.object",
"query":{
"bool":{
"must":[
{
"bool":{
"should":[
{
"range":{
"category.object.startdate":{
"lte":"2021-03-09T19:32:11.316Z"
}
}
},
{
"must_not":[
{
"exists":{
"field":"category.object.startdate"
}
}
]
}
]
}
}
]
}
}
}
}
]
}
}
}
当我提交该查询时,我收到错误“[must_not] 查询格式错误,查询名称后没有 start_object”。我们正在运行 ElasticSearch 5.3.1 版以防万一。
【问题讨论】:
-
我认为你需要另一个
bool来包装must_not
标签: elasticsearch