我试着用 multi_match 使用 elasticsearch-py 图书馆。
multi_match
设置如下:
res = helpers.scan(es, index="allcomms", query = { "multi_match" : { "query": 'multiple terms', "fields": ["text"] }})
我得到:
RequestError:RequestError(400,'解析\u异常','的未知键 [multi\u match]中的START\u对象。“)
有人知道有没有一种方法可以使用Elasticsearch py库进行此搜索吗?
我认为这个问题是不正确的。每当我们观察 parsing_exception 然后我们需要首先确保我们的查询可以通过 Kibana 或 Postman 或任何其他 RESTful client application 指向ES实例。
parsing_exception
Kibana
Postman
RESTful client application
您的代码必须采用以下格式。
res = helpers.scan(es, index="allcomms", query = { "query" : { "multi_match" : { "query": "multiple terms", "fields": ["text"] }}})
基本上下面是你的 multi-match 查询将是
POST <your_index_name>/_search { "query":{ "multi_match":{ "query":"multiple terms", "fields":[ "text" ] } } }