# Determine Analyzer For a Field In Scripted Engine

**URL:** <https://discuss.elastic.co/t/determine-analyzer-for-a-field-in-scripted-engine/199739>\
**Category:** Elasticsearch\
**Created:** [September 17, 2019, 12:10am UTC](https://discuss.elastic.co/t/determine-analyzer-for-a-field-in-scripted-engine/199739 "2019-09-17T00:10:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joshua\_Reback](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joshua_reback/32/38713_2.png) [@Joshua\_Reback](https://discuss.elastic.co/u/Joshua_Reback)\
**Post date:** [September 17, 2019, 12:10am UTC](https://discuss.elastic.co/t/determine-analyzer-for-a-field-in-scripted-engine/199739/1 "2019-09-17T00:10:31Z")

</div>

I'm trying to write a ScriptedEngine because I want to directly access some Lucene-level info (term frequency, position of term in the matched document, etc). In the ScriptedEngine, I want to analyze the query term using the same analyzer configured for the field that's being searched.

We have other plugins on our cluster deployment, specifically a `SearchPlugin`, where the task of analyzing a query term in this way is straightforward because when extending the `AbstractQueryBuilder` interface, you have to override the `doToQuery` method which accepts a `QueryShardContext` as a parameter, and you can use that parameter to figure out the analyzer.

Could someone guide me towards a way to do this in the context of the ScriptedEngine?

Thank you!

P.S., we are on Elasticsearch version 6.5.1.

---

<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:** [October 15, 2019, 12:10am UTC](https://discuss.elastic.co/t/determine-analyzer-for-a-field-in-scripted-engine/199739/2 "2019-10-15T00:10:36Z")

</div>

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