-
Book Overview & Buying
-
Table Of Contents
ElasticSearch Server
In the previous chapters, we discussed how to create index mappings and index the data. But what if you already have the mappings created, data indexed, but you want to modify the structure of the index? This is possible to some extent and soon we will learn how to do it.
Let's assume that we have the following mappings for our users index stored in the user.json file:
{
"user" : {
"properties" : {
"name" : {"type" : "string", "store" : "yes", "index" : "analyzed"}
}
}
}This is nothing unusual, just a simple type that stores the username. Let's create our index and let's create the type with the preceding mappings:
curl -XPOST 'localhost:9200/users' curl -XPUT 'localhost:9200/users/user/_mapping' -d @user.json
If everything went well, we will have our index and type created. So now let's try adding a new field to the mappings.
Let's assume that we want to add a new field that will store our user's phone...
Change the font size
Change margin width
Change background colour