"search_id" : "7f2d683165",
"uploaded_time" : "2019-05-10 15:25:35.373",
"processing_end_time" : "2019-05-10 15:25:38.115",
"batches" : {
"5cd598617026837753891a2b" : {
"is_reviewed" : false,
"batch_name" : "T--45"
}
}
如何针对我是否想要("is_reviewed" : true)
编写正确的查询?
我已经尝试过了:
query={"query": { "nested" : {"path" : "batches","query" : {"bool" : {"should" : [ { "match" : {"batches.is_reviewed" : true} }]}}}}}
res=es.search(index="cool",body={"query":{"match":{"pass":"true"}}})
我只希望输出"pass:true"
。
答案 0 :(得分:0)
您可以尝试以下方法:
{
"query": {
"query_string": {
"query": "batches.\\*.is_reviewed:true"
}
}
}
或者如果batches
是nested
则为:
{
"query": {
"nested": {
"path": "batches",
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "batches.\\*.is_reviewed:true"
}
}
]
}
}
}
}
}