# Analyzer from plugin works well when \_analyze is called but does not work in search

**URL:** <https://discuss.elastic.co/t/analyzer-from-plugin-works-well-when-analyze-is-called-but-does-not-work-in-search/155559>\
**Category:** Elasticsearch\
**Created:** [November 6, 2018, 2:05pm UTC](https://discuss.elastic.co/t/analyzer-from-plugin-works-well-when-analyze-is-called-but-does-not-work-in-search/155559 "2018-11-06T14:05:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Giannis\_Panagiwtakis](https://avatars.discourse-cdn.com/v4/letter/g/aeb1de/32.png) [@Giannis\_Panagiwtakis](https://discuss.elastic.co/u/Giannis_Panagiwtakis)\
**Post date:** [November 6, 2018, 2:05pm UTC](https://discuss.elastic.co/t/analyzer-from-plugin-works-well-when-analyze-is-called-but-does-not-work-in-search/155559/1 "2018-11-06T14:05:07Z")

</div>

Hello,  
I am an elastic search newbie and I have created a plugin in java, in order to use it as phonetics transformer for greek language. In the following snippet

"analysis": {  
"filter": {  
"greek\_stop": {"type": "stop", "stopwords": "_greek_"},  
"greek\_lowercase": {"type":"lowercase", "language": "greek"},  
"greek\_stemmer": {"type":"stemmer", "language":"greek"},  
"phonetics\_filter":{"type":"custom\_phonetics"}  
},  
"analyzer": {  
"rebuilt\_greek": { "tokenizer": "standard", "filter": ["greek\_lowercase", "greek\_stop", "greek\_stemmer"] },  
"dummy\_phonetics\_analyzer":{"tokenizer": "standard", "char\_filter":["phonetics\_mapping"]},  
"phonetics\_analyzer":{"tokenizer": "standard", "filter": ["greek\_lowercase", "greek\_stop", "phonetics\_filter"]}   
},  
"char\_filter":{   
"phonetics\_mapping":{"type": "mapping","mappings": ["οι =\> i", ..., "αί =\> E"] }  
}  
}  
rebuilt\_greek is a simple analyzer using elasticsearch tokenizer, greek stemmer and stopwords,  
phonetics\_analyzer is the analyzer which uses my plugin with the java code and dummy\_phonetics\_analyzer is an analyzer which uses a simple mapping from greek characters to latin, as in char\_filter.phonetics\_mapping (all definition at char\_filter.phonetics\_mapping.mappings is ommited).  
The field "street\_name" has 2 inner fields: phonetics, analyzed with phonetics\_analyzer and dummy\_phonetics, analyzed with dummy\_phonetics\_analyzer, i.e.:  
"street\_name": {"type": "text",  
"fielddata": true,  
"analyzer": "rebuilt\_greek",  
"fields":{"phonetics":{"type":"text", "analyzer":"phonetics\_analyzer", "search\_analyzer":"phonetics\_analyzer"},  
"dummy\_phonetics":{"type": "text","analyzer":"dummy\_phonetics\_analyzer", "search\_analyzer":"dummy\_phonetics\_analyzer"}}}  
Phonetics\_analyzer, when \_analyze is called it works well:  
GET addrs/\_analyze  
{  
"text": "Πατησίων"  
, "analyzer": "phonetics\_analyzer"  
}  
result  
{  
"tokens": [  
{  
"token": "patisIon",  
"start\_offset": 0,  
"end\_offset": 8,  
"type": "",  
"position": 0  
}  
]  
}

But, when in search, I have the following results:  
GET addrs/\_search?filter\_path=hits.total  
{"query":  
{"match":  
{"street\_name":{  
"query":  
"Πατησίων"}  
}

}  
}  
result  
{  
"hits": {  
"total": 573  
}  
}

GET addrs/\_search?filter\_path=hits.total  
{"query":  
{"match":  
{"street\_name.phonetics":{  
"query":  
"Πατησίων"}  
}  
}  
}  
result  
{  
"hits": {  
"total": 0  
}  
}  
On the contrary, dummy\_phonetics\_analyzer seems to work well:

GET addrs/\_search?filter\_path=hits.total  
{"query":  
{"match":  
{"street\_name.dummy\_phonetics":{  
"query":  
"Πατησίων"}  
}

}  
}  
result  
{  
"hits": {  
"total": 573  
}  
}

What am I doing wrong?  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 4, 2018, 2:05pm UTC](https://discuss.elastic.co/t/analyzer-from-plugin-works-well-when-analyze-is-called-but-does-not-work-in-search/155559/2 "2018-12-04T14:05:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
