# Define custom analyzer for highlight

**URL:** <https://discuss.elastic.co/t/define-custom-analyzer-for-highlight/207853>\
**Category:** Elasticsearch\
**Created:** [November 14, 2019, 10:03am UTC](https://discuss.elastic.co/t/define-custom-analyzer-for-highlight/207853 "2019-11-14T10:03:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![avivlevizky](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@avivlevizky](https://discuss.elastic.co/u/avivlevizky)\
**Post date:** [November 14, 2019, 10:03am UTC](https://discuss.elastic.co/t/define-custom-analyzer-for-highlight/207853/1 "2019-11-14T10:03:13Z")

</div>

After some study on the Lucene highlight that elastic search based on. I have an unanswered question.  
I want to use the standard tokenizer on the index/search stages (to utilize properly the token filters) and also to use the edge n-gram tokenizer to highlight (need to highlight the exact searched terms).

Without using the multi-field mapping option, there is an option to force somehow the highlighter to use a different analyzer/tokenizer for is reanalyzing stage only?

And if not, there is a way to write a custom tokenizer as a plugin that consists of a custom pipeline (tokenizer and collection of token filters)?

Example to clarify the desired outcome:  
index/search analyzer:  
"index\_search\_analyzer": {  
"type": "custom",  
"tokenizer": "standard",  
"filter": [  
"lowercase",  
"word\_delimiter"  
]  
}  
highlight analyzer:  
"highlight\_analyzer": {  
"type": "custom",  
"tokenizer": "edgeNGram" (min:3, max:8),  
"filter": [  
"lowercase",  
"word\_delimiter\_graph"  
]  
}  
indexed: "He123"  
search: "123"  
highlight: "He`123`"

---

<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 12, 2019, 10:03am UTC](https://discuss.elastic.co/t/define-custom-analyzer-for-highlight/207853/2 "2019-12-12T10:03:15Z")

</div>

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