我在inner_hits使用 Python 弹性搜索访问数据时遇到了问题。我越来越
RequestError(400,'search_phase_execution_exception', 'failed to create query'
当我尝试使用inner_hits{}.
我的弹性搜索版本 6.5.4,python 版本 3.7.2。
from elasticsearch import Elasticsearch
es = Elasticsearch()
mapping = '''{
"mappings": {
"tablets": {
"properties": {
"Names": {
"type": "nested"
"properties":{
"ID": {"type" : "long"},
"Combination": {"type" : "text"},
"Synonyms": {"type" : "text"}
}
}
}
}
}
}'''
es.indices.create(index="2", ignore=400, body=mapping)
tablets = {
"Names":[
{
"ID" : 1,
"Combination": "Paracetamol",
"Synonyms": "Crocin"
},{
"ID" : 2,
"Combination": "Pantaprazole",
"Synonyms": "Pantap"
}]} …Run Code Online (Sandbox Code Playgroud)