Update mapping gives error


(trusha) #1

I m getting merge_mapping_exception when I m updating mapping,

http://localhost:9200/logstash/filedoc/_mapping?ignore_conflicts=true

{
  "properties": {
    "id": {
      "type": "long"
    }
  }
}


{
  "logstash": {
    "aliases": {},
    "mappings": {
      "filedoc": {
        "properties": {
          "@timestamp": {
            "type": "date",
            "format": "strict_date_optional_time||epoch_millis"
          },
          "@version": {
            "type": "string"
          },
          "date": {
            "type": "date",
            "format": "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "ignition": {
            "type": "string"
          },
          "lat": {
            "type": "string"
          },
          "long": {
            "type": "string"
          },
          "odometer": {
            "type": "string"
          },
          "reg": {
            "type": "string"
          },
          "speed": {
            "type": "string"
          },
          "time": {
            "type": "string"
          }
        }
      }
    }
>

(David Pilato) #2

Hard to know exactly what you are doing here but it sounds like you are providing only id field in the PUT Mapping request.

Also you can't change a String to a number.


(trusha) #3

If I want to change existing field type (here id) from string to long? Is it possible with mapping?
If no? what are the ways to change existing field type to other type.


(David Pilato) #4

You have to reindex.

You can read this: http://david.pilato.fr/blog/2015/05/20/reindex-elasticsearch-with-logstash/


(system) #5