【问题标题】:error in Analyzer while creating an index创建索引时分析器中的错误
【发布时间】:2016-02-29 10:12:11
【问题描述】:

我正在尝试使用以下设置在 elasticsearch 中创建索引。我面临以下错误

错误: RemoteTransportException[[ys2order-stg2-01][inet[/64.101.206.15:9300]][indices:admin/mapping/put]]; 嵌套:MapperParsingException [分析器 [自动完成] 未找到 字段 [DESCRIPTION_AUTO]];状态:400

{
  "settings": {
    "index": {
      "analysis": {
        "filter": {
          "autocomplete_filter": {
            "type": "edge_ngram",
            "min_gram": 1,
            "max_gram": 20
          }
        },
        "analyzer": {
          " autocomplete": {
            "type": "custom",
            "filter": [
              "lowercase",
              "autocomplete_filter"
            ],
            "tokenizer": "standard"
          }
        }
      },
      "refresh_interval": -1,
      "number_of_replicas": 1,
      "number_of_shards": 4,
      "index_analyzer": "default_index",
      "search_analyzer": "default_search"
    }
  },
  "mappings": {
    "itemsnew": {
      "properties": {
        "DESCRIPTION_AUTO": {
          "index_analyzer": "autocomplete",
          "search_analyzer": "standard",
          "type": "string"
        }
      }
    }
  }
}

【问题讨论】:

    标签: indexing elasticsearch mapping analyzer


    【解决方案1】:

    您需要删除分析器名称中的空格:

        "analyzer": {
          " autocomplete": {       <--- remove initial space here
            "type": "custom",
            "filter": [
              "lowercase",
              "autocomplete_filter"
            ],
            "tokenizer": "standard"
          }
        ....
        "DESCRIPTION_AUTO": {
          "index_analyzer": "autocomplete",   <-- because there is no initial space here !!!
          "search_analyzer": "standard",
          "type": "string"
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-16
      • 1970-01-01
      • 1970-01-01
      • 2017-06-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多