我有一个查询GET index/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"key1": "value"
}
},
{
"wildcard": {
"key2": "*match*"
}
}
]
}
}
}
我想使用
elasticsearch_dsl
包进行相同的调用我尝试过
s = Search(index=index).query({
"bool": {
"should": [
{
"match": {
"key1": "value"
}
},
{
"wildcard": {
"key2": "*match*"
}
}
]
}
})
s.using(self.client).scan()
但是结果不一样,我在这里遗漏了什么吗?
有没有办法用
elasticsearch_dsl
表示我的查询尝试了这个,没有结果
s = Search(index=index).query('wildcard', key2='*match*').query('match', key1=value)
s.using(self.client).scan()
最佳答案
在我看来,您忘记了查询中的星星。
s = Search(index=index).query('wildcard', key='*match*').query('match', key=value)
关于elasticsearch - 如何将Kibana查询转换为 `elasticsearch_dsl`查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59889059/