2016-03-07 72 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" 
    } 
    } 
} 

作品對我來說