Custom analyzer is Not effecting to the data of the mapping field,even though i added it to the mapping field

Hi Everyone

I am implementing custom analyzer using follwing example and adding that analyzer to the mapping filed. But that analyzer is not effecting to the mapping field.

EXAMPLE:
*first creating analyzer in settings and adding that anaylzer to the field in the mapping
POST sa
{
"settings":{
"analysis":{
"analyzer":{
"full_name":{
"filter":"lowercase",
"type":"custom",
"tokenizer":"standard"
}
}
}
},
"mappings": {
"check":{
"properties": {
"name":{
"type": "string",
"analyzer": "full_name"
}
}
}
}
}

*indexing the data
POST sa/check/1
{
"_id":1,

"name":"BALU67 Guyfhf"
}

Now in the above example when i use this GET /sa/_analyze?analyzer=full_name/text=YFSDD
i am getting lowercase letters given in the text attribute.That fine work with that,
BUT when that analyzer is not applying to the data of the field mapping....
i.e When i try like his
GET sa/check/_seach

I should get the data inside that added mapping field to be lowercase...But getting as it is

Is their any way like that?
As i am New to this concept any one please help me out
Thanks

Hey Balaji,

I have seen two ways to add an custom analyzer.

  1. Put a custom analyzer definition globally so that you can share/reuse it among different indices. For this we need use this syntax
  2. Make the custom analyzer definition as part of the index mapping definition so that it available only for that index.

In your case you are following the second approach.

Whatever result you receive on executing GET sa/check/_search is from the _source field which contains the original JSON document body that was passed at index time.
https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html

I think there nothing wrong with the response you are getting. This the expected behavior.

Thanks,
Pavan

Thanks a lot .
Can u please help me how to keep custom analyzer globally so that to apply
to indices data or ping me any link for that

Hey,
check this

Thanks,
Pavan

Ya thannk u....

I will try it out with the templetes