我有以下ElasticSearch参数。
我正在尝试使用查询中的任何ID搜索类别类型。
但是,下面的搜索参数正在获取所有类别类型。
{
"size": 25,
"query": {
"bool": {
"must": [
{
"match": {
"organization_id": "dummy_organization"
}
},
{
"match": {
"object_type": "category"
}
},
{
"bool": {
"must": [
{
"bool": {
"should": [
{
"match": {
"category_type_id": "94f7dc26b611a5c2"
}
},
{
"match": {
"category_type_id": "b630613358520d51"
}
}
]
}
},
{
"bool": {
"must_not": [
]
}
}
]
}
}
]
}
},
"sort": [
{
"category_name": {
"order": "asc"
}
}
]
}
1条答案
按热度按时间bq8i3lrv1#
您遗漏了shouds上的最小should匹配计数。
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html#bool-min-should-match
您还可以简化查询: