# How to add new fields on document on ingestion based on value of other fields

**URL:** <https://discuss.elastic.co/t/how-to-add-new-fields-on-document-on-ingestion-based-on-value-of-other-fields/199519>\
**Category:** Elasticsearch\
**Created:** [September 15, 2019, 5:27am UTC](https://discuss.elastic.co/t/how-to-add-new-fields-on-document-on-ingestion-based-on-value-of-other-fields/199519 "2019-09-15T05:27:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![opsuthar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/opsuthar/32/54216_2.png) [@opsuthar](https://discuss.elastic.co/u/opsuthar)\
**Post date:** [September 15, 2019, 5:27am UTC](https://discuss.elastic.co/t/how-to-add-new-fields-on-document-on-ingestion-based-on-value-of-other-fields/199519/1 "2019-09-15T05:27:04Z")

</div>

I have a scenario where different applications are sending different fields for the same purpose which is making getting the aggregates/query data difficult and resulting in Big query.

Here is one of the field which specifies the file path.

For example:

1. App 1 -\> Sending "FilePath" as the file path
2. App 2 -\> Sending "CurrentFilePath" as the file path
3. App 3 -\> Sending "ItemPath" as the file path

As you can see the above Apps are sending 3 different fields for the file path. Is there a way I can populate an extra field "FilePath" for App2 and App3 documents on ingestion, so that single query on field "FilePath" and aggregation on "FilePath" can work.

NOTE: When I search for documents with field "FilePath", I want to get the complete document with all properties including "FilePath" for all the apps.

I would really appreciate if someone can help me here.

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [September 15, 2019, 10:16pm UTC](https://discuss.elastic.co/t/how-to-add-new-fields-on-document-on-ingestion-based-on-value-of-other-fields/199519/2 "2019-09-15T22:16:23Z")

</div>

You should be able to do this in an [ingest pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/current/accessing-data-in-pipelines.html)

Send app 2 & 3 to an ingest pipeline for each that renames it's field to "FilePath".

---

<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 13, 2019, 10:25pm UTC](https://discuss.elastic.co/t/how-to-add-new-fields-on-document-on-ingestion-based-on-value-of-other-fields/199519/3 "2019-10-13T22:25:11Z")

</div>

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