【发布时间】:2020-12-04 05:48:10
【问题描述】:
下面的查询是我想用elasticsearch-dsl-py构造的,但是不知道怎么做。
GET /my_index/_search
{
"query": {
"filtered": {
"filter": {
"bool": {
"should": [
{
"term": {
"status": "a"
},
"term": {
"status": "b"
},
"term": {
"status": "c"
}
}
]
}
}
}
}
}
我只想以 SQL 格式执行如下查询
select * from my_index where status in ("a","b","c")
使用elasticsearch-dsl-py,这是我能得到的最接近的,但它不一样。
class MyIndex(Document):
status = Keyword() / Text()
MyIndex.search().filter('should', status=["a","b","c"])
【问题讨论】:
标签: python-3.x elasticsearch dsl elasticsearch-dsl