[英]Using multi_match with Elasticsearch bulk scan in Python
I'm trying to use the multi_match
functionality within Elasticsearch using the elasticsearch-py library.我正在尝试使用
multi_match
-py库在 Elasticsearch 中使用multi_match
功能。
Setting it up like this:像这样设置:
res = helpers.scan(es, index="allcomms", query = {
"multi_match" : {
"query": 'multiple terms',
"fields": ["text"]
}})
I get:我得到:
RequestError: RequestError(400, 'parsing_exception', 'Unknown key for a START_OBJECT in [multi_match].')
RequestError: RequestError(400, 'parsing_exception', '[multi_match] 中 START_OBJECT 的未知键。')
Anyone know if there is a way to conduct this search using the Elasticsearch-py library?任何人都知道是否有办法使用 Elasticsearch-py 库进行此搜索?
Thanks!谢谢!
I think the query is not correct.我认为查询不正确。 Whenever we observe the
parsing_exception
then we need to first ensure that the query we have works via Kibana
or Postman
or any other RESTful client application
pointing to the ES instance.每当我们观察到
parsing_exception
我们首先需要确保我们的查询通过Kibana
或Postman
或任何其他指向 ES 实例的RESTful client application
。
Your code has to be in the below format.您的代码必须采用以下格式。
res = helpers.scan(es, index="allcomms", query = { "query" : {
"multi_match" : {
"query": "multiple terms",
"fields": ["text"]
}}})
Basically below is how your multi-match query would be基本上下面是您的多匹配查询的方式
POST <your_index_name>/_search
{
"query":{
"multi_match":{
"query":"multiple terms",
"fields":[
"text"
]
}
}
}
Let me know if it helps!如果有帮助,请告诉我!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.