gpt4 book ai didi

elasticsearch - Elasticsearch 在创建索引时出错

转载 作者:行者123 更新时间:2023-12-01 15:38:55 26 4
gpt4 key购买 nike

我是 ES 的新手...在网上找到了一个教程:

PUT /company
{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"analysis": {
"analyzer": {
"analyzer-name": {
"type": "custom",
"tokenizer": "keyword",
"filter": "lowercase"
}
}
}
},
"mappings": {
"properties": {
"age": {
"type": "integer"
},
"experienceInYears": {
"type": "integer"
},
"name": {
"type": "keyword",
"analyzer": "analyzer-name"
}
}
}
}

这有什么问题?我收到以下错误:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [name] has unsupported parameters: [analyzer : analyzer-name]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_doc]: Mapping definition for [name] has unsupported parameters: [analyzer : analyzer-name]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [name] has unsupported parameters: [analyzer : analyzer-name]"
}
},
"status": 400
}

我知道是现场分析器导致了这个问题:),但这不是正确的吗?

最佳答案

关键字 数据类型没有 分析仪 参数,正文 数据类型有。

检查文档中允许的两种数据类型的参数:

  • keyword
  • text

  • 因此,您的名称属性映射应更改为此。
      ...
    "name": {
    "type": "text",
    "analyzer": "analyzer-name"
    }
    ...

    关于elasticsearch - Elasticsearch 在创建索引时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59061272/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com