Home > other >  Elasticsearch automatic search Suggestions Unknown SuggestionBuilder [autocomplete]
Elasticsearch automatic search Suggestions Unknown SuggestionBuilder [autocomplete]

Time:09-19

The great god have understand elasticsearch? Met an auto complete problem can you help me?

This is I built index
 
Url="http://localhost:9200/autocomplete"


Content={
"The mappings" : {
"Values" : {
"Properties" : {
"Value" : {" type ":" text "},
"Value_suggest" : {
"Type" : "completion",
"Analyzer" : "ik_max_word,"
# "search_analyzer" : "ik_max_word",
# "preserve_position_increments" : False,
# "preserve_separators" : False
}
}
}
}
}
Content=json. Dumps (content)
The response=requests. Request (" PUT ", url, data=https://bbs.csdn.net/topics/payload, headers=headers)


Search statement:
 
Content={
"Suggest" : {
"Autocomplete" : {
"The prefix" : STR (search_term),
"Completion" : {
"Field" : "value_suggest
"}
}
}
}
Content=json. Dumps (content)
# print (content)

Url="http://192.168.4.36:9200/autocomplete/_suggest? Pretty
"The response=requests. Request (" GET ", url, data=https://bbs.csdn.net/topics/payload, headers=headers)



Returns:
 
The POST request called
Sugar
Suggest {" error ": {' root_cause: [{' type ':' unknown_named_object_exception ', 'reason' : 'Unknown SuggestionBuilder [autocomplete]', 'the line' : 1, 'col: 30}],' type ':' unknown_named_object_exception ', 'reason' : 'Unknown SuggestionBuilder [autocomplete]', 'the line' : 1, 'col: 30}," status ": 400}
192.168.16.225-06/May/2020 10:13:17 "POST/autocomplete HTTP/1.1" 200 -



  • Related