python中的弹性搜索过滤
我试图过滤掉弹性搜索查询以创建一个数据帧。我在iam应用过滤器的数据框中有两列type和api。当我应用一列作为条件时,它工作正常..:-python中的弹性搜索过滤,python,python-3.x,python-2.7,elasticsearch,elastic-stack,Python,Python 3.x,Python 2.7,elasticsearch,Elastic Stack,我试图过滤掉弹性搜索查询以创建一个数据帧。我在iam应用过滤器的数据框中有两列type和api。当我应用一列作为条件时,它工作正常..:- result_dict = es.search(index="logstash-2018.08.11-alias", body={"from": 0, "size": 10000,"query": {"term" : {"type":"vx_apache_json"}}}) 但当我应用以下多种条件
result_dict = es.search(index="logstash-2018.08.11-alias",
body={"from": 0, "size": 10000,"query":
{"term" : {"type":"vx_apache_json"}}})
但当我应用以下多种条件时:-
result_dict = es.search(index="logstash-2018.08.11-alias", body={"from": 0, "size": 1000,"queries": [
{ "term" : {"type" :"vx_apache_json"}},
{ "term" : {"api" :"viv_signin.php"}}
]})
我得到以下错误:-
RequestError:RequestError400,“正在分析\u异常”,“在[queries]中启动\u数组的未知键。”
有人能帮我在弹性搜索中设置多重过滤吗。试试下面的代码:-
result_dict = es.search(index="logstash-2018.08.11-alias", body={"from": 0, "size": 1000,"query": {
"constant_score" : {
"filter" : {
"bool" : {
"must" : [
{ "term" : { "type" :"vx_apache_json" } },
{"term" :{ "api" :"viv_signin.php" }}
]
}
}
}
}
}
)
以同样的方式继续添加过滤器