重新绘制弹性搜索

时间:2016-03-07 07:19:54

标签: elasticsearch logstash kibana bigdata

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": {}
  }
}'

2 个答案:

答案 0 :(得分:7)

首先需要删除索引,然后使用正确的映射重新创建它。在这里,您收到错误index_already_exists_exception,因为您尝试在旧索引仍然存在时创建索引,因此发生冲突。

首先运行:

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

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

答案 1 :(得分: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"
    }
  }
}

适合我