# Analyzer plugin needs access to multiple fields

**URL:** <https://discuss.elastic.co/t/analyzer-plugin-needs-access-to-multiple-fields/35562>\
**Category:** Elasticsearch\
**Created:** [November 25, 2015, 2:09pm UTC](https://discuss.elastic.co/t/analyzer-plugin-needs-access-to-multiple-fields/35562 "2015-11-25T14:09:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrewwwooster](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@andrewwwooster](https://discuss.elastic.co/u/andrewwwooster)\
**Post date:** [November 25, 2015, 2:09pm UTC](https://discuss.elastic.co/t/analyzer-plugin-needs-access-to-multiple-fields/35562/1 "2015-11-25T14:09:58Z")

</div>

I have a Analyzer plugin which uses a TokenFilter to annotates tokens. My fields therefore have a) the original text and b) the corresponding annotation map. I am finding it very difficult to bring these two things together in an Analyzer.

Here's what I have tried:

1. two fields  
I store the text in one field (e.g. text) and the annotation map in another field (e.g. annot).  
THE PROBLEM: An Analyzer only sees the fieldName and the field's token stream. So when analyzing the text field, I have not found a way to access the contents of annot field. Is there a way to access other fields in an Analyzer?

2. single field with delimiter  
I store the text and annotation map in a single field, separating with a delimiter. My token filter uses the synonym map during the analyses of the text and ensures that the post delimiter annotation map is filtered out.  
THE PROBLEM: While the appended annotation map are not indexed as terms, it still appears in the \_source; this means that it can pollute results from the query highlighter.

Any other ideas?

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [November 25, 2015, 4:19pm UTC](https://discuss.elastic.co/t/analyzer-plugin-needs-access-to-multiple-fields/35562/2 "2015-11-25T16:19:42Z")

</div>

Have you looked into using Lucene payloads? Elasticsearch has a payload  
filter as well.

Ivan

---

<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:** [July 5, 2017, 11:35pm UTC](https://discuss.elastic.co/t/analyzer-plugin-needs-access-to-multiple-fields/35562/3 "2017-07-05T23:35:49Z")

</div>


