Elasticsearch Reindex.

In here discuss about elasticsearch reindexing with kibana dashboard.For that there are few APIs.There is a service call “Dev Tools” in kibana dashboard.You can navigate into using left side menu.

In figure 01 shows the dev tool console.In this example I m going to reindex “temp_1” index.
First you need to check the index pattern data types.For that there is an API.
GET {your_index_name}/_mapping

In Figure 01 show the result for that GET API.Then check the data types you need to change.
Then you need to create a temporary index.For that you can use PUT API.For this API you need copy all details inside the “mappings” , shows in figure 02 result.

Then you need to change the data types you need to change.As example in Figure 03 , If you need “@API_Name” as a number field you can use float , long like data types. kibana gives the suggestions for that.In here i m using long and execute that API.

In figure 04 shows after executing PUT API for create the temp index with “@API_Name” data type as long.If you successfully execute that API you can get figure 04 result.
Then we need to use that reindexing API.
POST _reindex
{
“source”: {
“index”: “{source_index}” <- here our source index is “temp_1”
},
“dest”: {
“index”: “{destination_index}” <- here our destination index is “temp”
}
}

In figure 05 shows the reindexing API and the result.now all the data inside the “temp_1” copied into the “temp” index.
Now you need to delete your source index.Here temp_1.For that we can use DELETE API.
DELETE {source_index}

In figure 06 show the result after deleting the temp_1 index.
Then u need to create again temp_1 index manually same as Figure 04.

In figure 07 shows how to create the temp_1 index again.
Then you need to use that reindex API same as figure 05.Only change you need to change that destination and source index names.Now our source index is “temp” index.Because we copied all the data to “temp” index.Our destination is “temp_1” index.

In figure 08 shows how to recopy our data to “temp_1” index.Then you can check whether our “temp_1” index data types are changed or not.For that u can use figure 02 API.

In figure 09 shows, how “temp_1” index data types after the reindex. You can see in figure 09 “@API_Name” data type has changed to long type.before it was in text data type.
If it worked , now you can delete “temp” index by using DELETE API as shown in figure 06.
Thank you.