当我想在elasticsearch索引文档时出现这个问题:
message [MapperParsingException[failed to parse]; nested: IllegalArgumentException[unknown field name [output], must be one of [input, weight, contexts]];]
我知道在版本5中从elasticsearch中删除了输出字段,但为什么?我需要做些什么来获得输入的单一结果?
答案 0 :(得分:1)
output
字段,现在_source
归档了该建议。示例如下所示。
<强>映射强>
{
"user": {
"properties": {
"name": {
"type": "string"
},
"suggest": {
"type": "completion",
"analyzer": "simple",
"search_analyzer": "simple"
}
}
}
}
数据强>
{
"id": "123",
"name": "Abc",
"suggest":
{
"input": "Abc::123"
},
"output": "Abc::123"
}
<强>查询强>
POST - http://localhost:9200/user * / _建议?漂亮
{
"type-suggest": {
"text": "Abc",
"completion": {
"field": "suggest"
}
}
}
答案 1 :(得分:0)