# Issue: Getting wrong data in aggs using script or field property

**URL:** <https://discuss.elastic.co/t/issue-getting-wrong-data-in-aggs-using-script-or-field-property/193738>\
**Category:** Elasticsearch\
**Created:** [August 5, 2019, 7:13am UTC](https://discuss.elastic.co/t/issue-getting-wrong-data-in-aggs-using-script-or-field-property/193738 "2019-08-05T07:13:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vishal\_Shetty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishal_shetty/32/51614_2.png) [@Vishal\_Shetty](https://discuss.elastic.co/u/Vishal_Shetty)\
**Post date:** [August 5, 2019, 7:13am UTC](https://discuss.elastic.co/t/issue-getting-wrong-data-in-aggs-using-script-or-field-property/193738/1 "2019-08-05T07:13:45Z")

</div>

Hey guys,

Can someone please help me on this issue.

> <https://github.com/elastic/elasticsearch/issues/45168#issuecomment-518109324>

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [August 5, 2019, 7:53am UTC](https://discuss.elastic.co/t/issue-getting-wrong-data-in-aggs-using-script-or-field-property/193738/2 "2019-08-05T07:53:20Z")

</div>

Could you share the mapping you are using for the index gokhanaprod ?

---

<div class="post-metadata">

**Author:** ![Vishal\_Shetty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishal_shetty/32/51614_2.png) [@Vishal\_Shetty](https://discuss.elastic.co/u/Vishal_Shetty)\
**Post date:** [August 5, 2019, 9:06am UTC](https://discuss.elastic.co/t/issue-getting-wrong-data-in-aggs-using-script-or-field-property/193738/3 "2019-08-05T09:06:54Z")

</div>

Here you can find the mapping

[Field mapping](https://drive.google.com/open?id=1EGuCDnMUo7oigd1TuH2OCAJuDUWyG4m3)

---

<div class="post-metadata">

**Author:** ![Vishal\_Shetty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishal_shetty/32/51614_2.png) [@Vishal\_Shetty](https://discuss.elastic.co/u/Vishal_Shetty)\
**Post date:** [August 6, 2019, 7:57am UTC](https://discuss.elastic.co/t/issue-getting-wrong-data-in-aggs-using-script-or-field-property/193738/4 "2019-08-06T07:57:02Z")

</div>

Hey any updates on this

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [August 16, 2019, 10:49am UTC](https://discuss.elastic.co/t/issue-getting-wrong-data-in-aggs-using-script-or-field-property/193738/5 "2019-08-16T10:49:40Z")

</div>

You may try to update your mapping using nested type, change also your agg to use nested

---

<div class="post-metadata">

**Author:** ![Vishal\_Shetty](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishal_shetty/32/51614_2.png) [@Vishal\_Shetty](https://discuss.elastic.co/u/Vishal_Shetty)\
**Post date:** [September 10, 2019, 10:15am UTC](https://discuss.elastic.co/t/issue-getting-wrong-data-in-aggs-using-script-or-field-property/193738/6 "2019-09-10T10:15:33Z")

</div>

Is there any other solution available without mapping using nested type, I know nested type may be the easiest way to do it but we have lot of data now and my manager is not agreeging to do anything to the server by changing the mapping for nested objects.

---

<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 8, 2019, 10:15am UTC](https://discuss.elastic.co/t/issue-getting-wrong-data-in-aggs-using-script-or-field-property/193738/7 "2019-10-08T10:15:39Z")

</div>

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