Do we have any Plugin to update Mappings on the fly?


(Vikas Gopal) #1

Hi Experts,

I know that we can update /create or modify my existing Mappings using SENSE or I can directly achieve this with Mapping API.
My question is do we have any GUI or plugin from where I can update/Delete/Create Mapping for an Index in elasticsearch , Plus I can also change the field type like from string to int etc on the fly. I saw ElasticHQ but in this I can only delete the mapping . Please guide or suggest any other GUI.

Thanks
VG


(Christoph) #2

Hi Vikas,

with a few exceptions stated here, the mapping for existing fields cannot be updated. Also, starting with 2.0 it is no longer possible to delete a type mapping. To change a mapping you have to create a new index with the new mapping and reindex your data to it. For older versions, this blog post describes the process. Also note there is work in progress to simplify this reindexing procedure using a dedicated API for this, see this Github issue for details.


(Vikas Gopal) #3

Thanks for the response Chris,

I like Alias Idea , but since i am new so I followed the instruction as per blog the only challenge for me is to copy old index document into new index .Till now what I have done is

  1. I have created alias for my existing Index and then create a new index with new name and mapping and assigned the same alias name to it.e.g
POST /_aliases> {
"actions": [
{ "remove": {
"alias": "vikas_alias",
"index": "corr"
}},
{ "add": {
"alias": "vikas_alias",
"index": "vikas"
}}
]

Here corr is my old index and vikas is my new index.

  1. After doing all above I can see following after firing GET /_cat/indices/?v

    health status index pri rep docs.count docs.deleted store.size pri.store.size
    yellow open .kibana 5 1 10 2 70.2kb 70.2kb
    yellow open vikas 5 1 0 0 720b 720b
    yellow open corr 5 1 400 0 2.2mb 2.2mb
    Now what I want is to copy all 400 documents from corr to vikas , please help me to do that.


(Mark Walkom) #4

You can use something like Logstash to do that, https://gist.github.com/markwalkom/8a7201e3f6ea4354ae06


(Vikas Gopal) #5

Thanks Mark,

It works.


(system) #6