Reputation: 422
I have some fields in elastic search type as string and index as not_analysed.
while searching for the values of those fields some time I need index as analysed also.
So is it possible to do multiple mapping in elastic search for one single index.
In my case one for index as not_analysed and second one for index as analysed.
Thanks Mukesh Raghuwanshi
Upvotes: 3
Views: 1188
Reputation: 217564
Yes of course, you can use multi-field
for exactly this purpose. Your field needs to be declared as follows in your mapping type:
{
"your_type" : {
"properties" : {
"your_field" : { <-- this is the analyzed version of the field
"type" : "string",
"index" : "analyzed",
"fields" : {
"raw" : { <-- this is the not_analyzed sub-field
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
}
Upvotes: 4