# Analysis plugin to access multiple fields from source document

**URL:** <https://discuss.elastic.co/t/analysis-plugin-to-access-multiple-fields-from-source-document/49022>\
**Category:** Elasticsearch\
**Created:** [May 3, 2016, 7:59am UTC](https://discuss.elastic.co/t/analysis-plugin-to-access-multiple-fields-from-source-document/49022 "2016-05-03T07:59:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pyppe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pyppe/32/3531_2.png) [@Pyppe](https://discuss.elastic.co/u/Pyppe)\
**Post date:** [May 3, 2016, 7:59am UTC](https://discuss.elastic.co/t/analysis-plugin-to-access-multiple-fields-from-source-document/49022/1 "2016-05-03T07:59:19Z")

</div>

I need to analyze a textual field based on other field in the source document. For example, let's say we have two separate documents:

```auto
// Document A
{
  "registry": "fi",
  "id": "FIN 1234"
}
// Document B
{
  "registry": "us",
  "id": "456 US 789"
}

```

I need to analyze & tokenize the `"id"`-field differently based on what's the value of the `"registry"`-field. How can this be achieved? I've tried to see the source-code of other [Analysis plugins](https://github.com/elastic/elasticsearch/tree/master/plugins), but I cannot find a way to achieve this. Any tips?

Thank you!

---

<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, 10:54pm UTC](https://discuss.elastic.co/t/analysis-plugin-to-access-multiple-fields-from-source-document/49022/2 "2017-07-05T22:54:29Z")

</div>


