是否有可能查詢2個不同標籤具有指定列表中的值的記錄?Elasticsearch - 搜索標籤是否包含列表中的值
matches_list = ["4000000031265595", "4000000031265596", "4000000030004305", "4000000029975772"]
query = {
"query": {
"bool": {
"must": [
{"match": {"id_1": matches_list}},
{"match": {"id_2": matches_list}}
]
}
}
}
上述返回: elasticsearch.exceptions.TransportError: TransportError(500, u'illegal_state_exception', u"Can't get text on a START_ARRAY at 1:57")
更新使用大列表時
錯誤:
File "/usr/local/lib/python2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 128, in perform_request self._raise_error(response.status, raw_data) File "/usr/local/lib/python2.7/site-packages/elasticsearch/connection/base.py", line 122, in _raise_error raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info) elasticsearch.exceptions.RequestError: TransportError(400, u'search_phase_execution_exception', u'failed to create query: {\n "bool" : {\n "must" : [\n {\n "terms" : {\n "id_1" : my list in here ],\n "boost" : 1.0\n }\n }\n ],\n "disable_coord" : false,\n "adjust_pure_negative" : true,\n "boost" : 1.0\n }\n}')
哪些類型id_1'和'id_2'的'。 – khachik