2016-03-07 67 views
2

logstash config我已经在elasticsearch上创建了我的索引,并通过kibana创建了我的索引并已上传数据。现在我想改变索引的映射,并将一些字段更改为不分析.Below是我想从现有的映射替换的映射。但是当我运行下面的命令,它给了我错误映射弹性搜索的娱乐

{ “错误”:{ “ROOT_CAUSE”:[{ “类型”: “index_already_exists_exception”, “原因”: “已经 存在”, “指标”: “rettrmt”}], “类型”: “index_already_exists_exception”, “原因”: “已经 存在”, “指数”: “rettrmt”}, “状态”:400}

请帮助得到它关。

curl -XPUT 'http://10.56.139.61:9200/rettrmt' -d '{ 
    "rettrmt": { 
    "aliases": {}, 
    "mappings": { 
     "RETTRMT": { 
     "properties": { 
      "@timestamp": { 
      "type": "date", 
      "format": "strict_date_optional_time||epoch_millis" 
      }, 
      "@version": { 
      "type": "string" 
      }, 
      "acid": { 
      "type": "string" 
      }, 
      "actor_id": { 
      "type": "string", 
      "index": "not_analyzed" 
      }, 
      "actor_type": { 
      "type": "string", 
      "index": "not_analyzed" 
      }, 
      "channel_id": { 
      "type": "string", 
      "index": "not_analyzed" 
      }, 
      "circle": { 
      "type": "string", 
      "index": "not_analyzed" 
      }, 
      "cr_dr_indicator": { 
      "type": "string", 
      "index": "not_analyzed" 
      }, 
      "host": { 
      "type": "string" 
      }, 
      "message": { 
      "type": "string" 
      }, 
      "orig_input_amt": { 
      "type": "double" 
      }, 
      "path": { 
      "type": "string" 
      }, 
      "r_cre_id": { 
      "type": "string" 
      }, 
      "sub_use_case": { 
      "type": "string", 
      "index": "not_analyzed" 
      }, 
      "tran_amt": { 
      "type": "double" 
      }, 
      "tran_id": { 
      "type": "string" 
      }, 
      "tran_particulars": { 
      "type": "string" 
      }, 
      "tran_particulars_2": { 
      "type": "string" 
      }, 
      "tran_remarks": { 
      "type": "string" 
      }, 
      "tran_sub_type": { 
      "type": "string" 
      }, 
      "tran_timestamp": { 
      "type": "date", 
      "format": "strict_date_optional_time||epoch_millis" 
      }, 
      "tran_type": { 
      "type": "string" 
      }, 
      "type": { 
      "type": "string" 
      }, 
      "use_case": { 
      "type": "string", 
      "index": "not_analyzed" 
      } 
     } 
     } 
    }, 
    "settings": { 
     "index": { 
     "creation_date": "1457331693603", 
     "uuid": "2bR0yOQtSqqVUb8lVE2dUA", 
     "number_of_replicas": "1", 
     "number_of_shards": "5", 
     "version": { 
      "created": "2000099" 
     } 
     } 
    }, 
    "warmers": {} 
    } 
}' 

回答

4

您首先需要删除您的索引,然后使用适当的映射重新创建索引。在这里你得到一个错误index_already_exists_exception,因为你尝试创建一个索引,而旧的索引仍然存在,因此冲突。

运行此第一:

curl -XDELETE 'http://10.56.139.61:9200/rettrmt' 

然后你就可以再次运行命令。请注意,这会清除您的数据,因此您必须重新填充索引。

+0

如果我会删除它会删除数据,以及该指数是不是? –

+0

但是我删除了索引,所以它也删除了数据,然后再次运行我的命令以更改映射。它只是把我需要的映射,但是当我再次上传数据,然后通过kibana再次看到分析的字段,我把它放在我的映射中没有分析。任何猜测我做错了什么。 –

+0

是的,但如果要更改映射,则没有选择。 – Val

0

你试过类似的东西吗?

curl -XPUT 'http://10.56.139.61:9200/rettrmt/_mapping/RETTRMT' -d ' 
{ 
    "properties": { 
    "actor_id": { // or whichever properties you want to add 
      "type": "string", 
      "index": "not_analyzed" 
    } 
    } 
} 

作品对我来说