# Update values based on previous documents

**URL:** <https://discuss.elastic.co/t/update-values-based-on-previous-documents/296406>\
**Category:** Elasticsearch\
**Created:** [February 7, 2022, 12:40am UTC](https://discuss.elastic.co/t/update-values-based-on-previous-documents/296406 "2022-02-07T00:40:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SKraine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skraine/32/99794_2.png) [@SKraine](https://discuss.elastic.co/u/SKraine)\
**Post date:** [February 7, 2022, 12:40am UTC](https://discuss.elastic.co/t/update-values-based-on-previous-documents/296406/1 "2022-02-07T00:40:22Z")

</div>

Hey Everyone!

So I am very new to the elastic stack and am currently working on my first application using it. I have data that comes from different files via filebeat. They then go through logstash to parse out the fields of the document. The problem is that some messages have different data compared to each other. For example:

```auto
doc1
{
"latitute": 20
"longitude": 30
}

doc2
{
"level": "Error"
}

```

However, I want to visualize the data via Kibana using a map. and I need the data from Doc1 and Doc2. Is there a way to use a script to access the data from Doc1 to update Doc2? I would prefer not to create additional documents if that is possible. Thanks for the help!

---

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [February 7, 2022, 1:08am UTC](https://discuss.elastic.co/t/update-values-based-on-previous-documents/296406/2 "2022-02-07T01:08:19Z")

</div>

Hi,

Yes you can use [aggregation filter plugin](https://www.elastic.co/guide/en/logstash/current/plugins-filters-aggregate.html) to aggregate some messages on specified rules.

---

<div class="post-metadata">

**Author:** ![SKraine](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skraine/32/99794_2.png) [@SKraine](https://discuss.elastic.co/u/SKraine)\
**Post date:** [February 24, 2022, 4:34pm UTC](https://discuss.elastic.co/t/update-values-based-on-previous-documents/296406/3 "2022-02-24T16:34:48Z")

</div>

Hey Tomo,  
I decided to work in a different direction as I need to do some more analysis after the collection so I ended up using the python API to pull the data.  
Thanks for the help!

---

<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:** [March 24, 2022, 4:35pm UTC](https://discuss.elastic.co/t/update-values-based-on-previous-documents/296406/4 "2022-03-24T16:35:20Z")

</div>

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