简体   繁体   English

Elasticsearch解析异常400

[英]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.

相关问题 Elasticsearch TransportError(400,'mapper_parsing_exception') - Elasticsearch TransportError(400, 'mapper_parsing_exception') Django/Haystack 错误:elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception',...) - Django/Haystack error: elasticsearch.exceptions.RequestError: TransportError(400, 'parsing_exception',…) elasticsearch.exceptions.RequestError: RequestError(400, 'mapper_parsing_exception', '没有在字段 [texts] 上声明的类型 [string] 的处理程序') - elasticsearch.exceptions.RequestError: RequestError(400, 'mapper_parsing_exception', 'No handler for type [string] declared on field [texts]') Elasticsearch mapper_parsing_exception - Elasticsearch mapper_parsing_exception 插入数据时,ElasticSearch Mapper解析异常 - ElasticSearch Mapper Parsing Exception while insertion of data RequestError:TransportError(400,u'parsing_exception')Django干草堆 - RequestError: TransportError(400, u'parsing_exception') django haystack elasticsearch 返回 RequestError 400 - elasticsearch returns RequestError 400 Python Elasticsearch,RequestError:TransportError(400,u'search_phase_execution_exception')间歇性地发生。 为什么? - Python Elasticsearch, RequestError: TransportError(400, u'search_phase_execution_exception') happens intermittently. Why? Elasticsearch TransportError(400,u'parse_exception',u'无法导出xcontent') - Elasticsearch TransportError(400, u'parse_exception', u'Failed to derive xcontent') RequestError:RequestError(400,search_phase_execution_exception未能为elasticsearch中的输入字符串创建查询 - RequestError: RequestError(400, search_phase_execution_exception failed to create query For input string in elasticsearch
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM