自动完成建议中的输出字段

2024-05-17

当我想在 elasticsearch 中索引文档时,会发生此问题:

message [MapperParsingException[failed to parse]; nested: IllegalArgumentException[unknown field name [output], must be one of [input, weight, contexts]];]

我知道输出字段在版本 5 中从 elasticsearch 中删除了,但为什么呢?我需要做什么才能获得输入的单一结果?


output现在,该字段已从版本 5 中的 ElasticSearch 中删除_source提交带有建议的申报表。示例如下所示。

Mapping

{
    "user": {
        "properties": {
            "name": {
                "type": "string"
            },
            "suggest": {
                "type": "completion",
                "analyzer": "simple",
                "search_analyzer": "simple"
            }
        }
    }
}

Data

{
    "id": "123",
    "name": "Abc",
    "suggest":
    {
        "input": "Abc::123"
    },
    "output": "Abc::123"
}

Query

POST - http://localhost:9200/用户 http://localhost:9200/user*/_建议?漂亮

{
"type-suggest": {
    "text": "Abc",
    "completion": {
        "field": "suggest"
    }
  }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

自动完成建议中的输出字段 的相关文章

随机推荐