[英]Elasticsearch parsing exception 400
I have been trying to amend my snippet in Python, but to no avail so far.我一直在尝试修改 Python 中的代码段,但到目前为止无济于事。 Once I run it, the following message gets populated:
一旦我运行它,就会填充以下消息:
elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', 'Unknown key for a START_ARRAY in [fields].')
Here is my code:这是我的代码:
from elasticsearch import Elasticsearch
client = Elasticsearch()
indexName = "medical"
docType = "diseases"
searchFrom = 0
searchSize = 3
searchBody = {
"fields": ["name"],
"query": {
"simple_query_string": {
"query": '+fatigue+fever+"joint pain"',
"fields": ["fulltext", "title^5", "name^10"]
}
}
}
client.search(
index=indexName,
doc_type=docType,
body=searchBody,
from_=searchFrom,
size=searchSize
)
I'm using elasticsearch version 7X.我正在使用 elasticsearch 版本 7X。
This refers to the property fields
one line above the query
property.这是指
query
属性上方一行的属性fields
。 It shouldn't be there.它不应该在那里。 Here's the dsl .
这是 dsl 。
I think "_source" is what ur looking for我认为“_source”是你要找的
replace "fields" with "_source"将“字段”替换为“_source”
searchBody = {
"_source": ["name"],
"query": {
"simple_query_string": {
"query": '+fatigue+fever+"joint pain"',
"fields": ["fulltext", "title^5", "name^10"]
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.