# Extend ES5 query parser to expand one field into many

**URL:** <https://discuss.elastic.co/t/extend-es5-query-parser-to-expand-one-field-into-many/98770>\
**Category:** Elasticsearch\
**Created:** [August 30, 2017, 1:15am UTC](https://discuss.elastic.co/t/extend-es5-query-parser-to-expand-one-field-into-many/98770 "2017-08-30T01:15:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joeferner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joeferner/32/21634_2.png) [@joeferner](https://discuss.elastic.co/u/joeferner)\
**Post date:** [August 30, 2017, 1:15am UTC](https://discuss.elastic.co/t/extend-es5-query-parser-to-expand-one-field-into-many/98770/1 "2017-08-30T01:15:35Z")

</div>

We are in the process of upgrading from ES1 to ES5. One of the plugins we had implemented was a custom query parser which was a copy of [QueryStringQueryParser](https://raw.githubusercontent.com/elastic/elasticsearch/1.7/src/main/java/org/elasticsearch/index/query/QueryStringQueryParser.java) with the added ability to expand field queries into many or'ed queries. So it might take a query like `name:joe` and expand it into `(first_name:joe OR last_name:joe OR title:joe)`

I have created a class and extended `Plugin` and implemented `getQueries` and my builder gets called which is great but it doesn't look like I can override the method that parses the fields `org.apache.lucene.queryparser.classic.MapperQueryParser#createFieldQuery` since the mapper is a final variable part of the context.

Anyone have any idea how I might be able to pull this off.

---

<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:** [September 27, 2017, 1:15am UTC](https://discuss.elastic.co/t/extend-es5-query-parser-to-expand-one-field-into-many/98770/2 "2017-09-27T01:15:41Z")

</div>

Closed on September 27, 2017, 1:15am UTC

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