windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server https://softhier.com/ instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

How to update data type of a field in elasticsearch

Asked By: Anonymous

I am publishing a data to elasticsearch using fluentd. It has a field Data.CPU which is currently set to string. Index name is health_gateway

enter image description here

I have made some changes in python code which is generating the data so now this field Data.CPU has now become integer. But still elasticsearch is showing it as string. How can I update it data type.

I tried running below commands in kibana dev tools:

PUT health_gateway/doc/_mapping
{
    "doc" : {
        "properties" : {
            "Data.CPU" : {"type" : "integer"}
        }
    }
}

But it gave me below error:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."
  },
  "status" : 400
}

There is also this document which says using mutate we can convert the data type but I am not able to understand it properly.

I do not want to delete the index and recreate as I have created a visualization based on this index and after deleting it will also be deleted. Can anyone please help in this.


Solution

Answered By: Anonymous

You can update the mapping, by indexing the same field in multiple ways i.e by using multi fields.

Using the below mapping, Data.CPU.raw will be of integer type

{
  "mappings": {
    "properties": {
      "Data": {
        "properties": {
          "CPU": {
            "type": "string",
            "fields": {
              "raw": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}

OR you can create a new index with correct index mapping, and reindex the data in it using the reindex API

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno