Elasticsearch 1.2.1异常:解析后根类型映射不为空

Mar*_*ark 23 java exception elasticsearch

更新到Elasticsearch后,1.2.1我继续在以下映射上获得以下异常:

{
    "tags": {
        "properties": {
            "tags": {
                "type": "string",
                "index": "not_analyzed"
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是例外:

Caused by: org.elasticsearch.index.mapper.MapperParsingException: Root type mapping not empty after parsing! Remaining fields: [tags : {properties={tags={index=not_analyzed, type=string}}}]
    at org.elasticsearch.index.mapper.DocumentMapperParser.parse(DocumentMapperParser.java:265)
    at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:189)
    at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:387)
    at org.elasticsearch.index.mapper.MapperService.merge(MapperService.java:253)
    at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService$2.execute(MetaDataCreateIndexService.java:363)
Run Code Online (Sandbox Code Playgroud)

这是为什么?

Joh*_*one 10

@Mark这似乎是1.2.X中的一个错误.已有多个其他人报告过类似的问题,我将链接到下面的门票.基本上看起来他们收紧了1.2.X中映射的语法,但它们似乎已经导致了以前有效映射的一些问题.你的就是一个例子.

我建议你打开一个错误报告 - 数字更强大.如果你打开一张票,我很乐意说"我也是",因为我在1.2.1上重新创建了这个问题.

现在我已经能够完成以下工作了,我相信它能给你带来同样的结果:

curl -XPUT localhost:9200/yourindexname -d 
'{
   "mappings":
   {
    "tags":
      {
       "properties":
         {
          "tags":
            {
             "type":"string",
             "index":"not_analyzed"
            }
          }
        }
    }
}'
Run Code Online (Sandbox Code Playgroud)

门票:

https://github.com/elasticsearch/elasticsearch/issues/6414

https://github.com/elasticsearch/elasticsearch/issues/6304

https://github.com/elasticsearch/elasticsearch/issues/6415

  • 当我尝试你建议的时候,我得到"{"错误":"IndexAlreadyExistsException [[indexName]已经存在]","status":400}".任何的想法? (2认同)
  • @KartikeyaSinha您可能尝试使用现有名称创建新索引. (2认同)

小智 6

这会对你有所帮助

你会想要你想做的事

curl -XPUT localhost:9200/new_index -d '
{
  "mappings": { 
    "tags": {
      "properties": {
        "tags": { 
           "type":"string",
           "index":"not_analyzed"
        }
      }
    }
  }
}'
Run Code Online (Sandbox Code Playgroud)

或者你也可以这样做

curl -XPUT localhost:9200/new_index/new_index_type/_mappings -d '
{
  "new_index_type": {
    "properties": {
      "tags": {
        "type": "string",
        "index": "not_analyzed"
      }
    }
  }
}'
Run Code Online (Sandbox Code Playgroud)