Python操作ElasticSearch条件查询

1.列表元素之一查询,如 "terminalType": ["pc", "mobile"]

正确用法:

GET   

http://0.0.0.0:8200/amis_action_data/data/_search?size=10000

查询条件:

Ps:数组查询要用关键字terms(如下面的terminalType字段 ,而不是term,否则会报错"[term] query does not support array of values"

{
    "query": {
        "bool": {
            "must": [
                {
                    "terms": {
                        "terminalType": ["pc", "mobile"]
                    }
                },
                {
                    "range": {
                        "time": {
                            "lte": 1631774498,
                            "gte": 1631030400
                        }
                    }
                },
                {
                    "term": {
                        "tab": "find"
                    }
                },
                {
                    "term": {
                        "series": "other"
                    }
                }
            ]
        }
    }
}

猜你喜欢

转载自blog.csdn.net/sinat_33718563/article/details/120330007
今日推荐