请问 es should 下嵌套多个 must 怎么写?

请问下如下 sql 语句如何转换为 ES 的 DSL 语句:

select * from table where ( 

( sex = 1 or sex = 2 ) and ( color = 226 or color = 229 )

) OR (

( sex = 0 or sex = 3 ) and ( color = 226 )

);

按我的理解,我写了下面一个 dsl 查询语句,但是报错:

{

"query": {

"bool": {

"should": [{

"must": [{

"bool": {

"should": [{

"match": {

"tags": "1"

}

}]

}

}]

}]

}

},

"size": 2

}

报错内容:

{

"error": {

"root_cause": [

{

"type": "parsing_exception",

"reason": "[must] query malformed, no start_object after query name",

"line": 5,

"col": 13

}

],

"type": "x_content_parse_exception",

"reason": "[5:13] [bool] failed to parse field [should]",

"caused_by": {

"type": "parsing_exception",

"reason": "[must] query malformed, no start_object after query name",

"line": 5,

"col": 13

}

},

"status": 400

}

以上是 请问 es should 下嵌套多个 must 怎么写? 的全部内容, 来源链接: utcz.com/p/945473.html

回到顶部