问题描述
下面的查询是我想使用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","c"])
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)