# Hits.total in Elasticsearch filter plugin

**URL:** <https://discuss.elastic.co/t/hits-total-in-elasticsearch-filter-plugin/148342>\
**Category:** Logstash\
**Created:** [September 12, 2018, 1:59pm UTC](https://discuss.elastic.co/t/hits-total-in-elasticsearch-filter-plugin/148342 "2018-09-12T13:59:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![javiyt](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@javiyt](https://discuss.elastic.co/u/javiyt)\
**Post date:** [September 12, 2018, 1:59pm UTC](https://discuss.elastic.co/t/hits-total-in-elasticsearch-filter-plugin/148342/1 "2018-09-12T13:59:44Z")

</div>

Hi everyone,

I'm trying to enrich an index adding some geodata information, counting the neighbours according to a query.

I'm using the elasticsearch filter to add this query, but I can't find a way to use either the \_count query or the hits.total of standard query to store it in a new field.

Any ideas?

Thank you.

---

<div class="post-metadata">

**Author:** ![javiyt](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@javiyt](https://discuss.elastic.co/u/javiyt)\
**Post date:** [September 13, 2018, 1:44pm UTC](https://discuss.elastic.co/t/hits-total-in-elasticsearch-filter-plugin/148342/2 "2018-09-13T13:44:51Z")

</div>

Apparently it's not developed this option.

What's the behaviour when the elasticsearch filter finds more than 1 ocurrence, it duplicates the entry?

---

<div class="post-metadata">

**Author:** ![javiyt](https://avatars.discourse-cdn.com/v4/letter/j/f05b48/32.png) [@javiyt](https://discuss.elastic.co/u/javiyt)\
**Post date:** [September 13, 2018, 4:26pm UTC](https://discuss.elastic.co/t/hits-total-in-elasticsearch-filter-plugin/148342/3 "2018-09-13T16:26:01Z")

</div>

Just in case someone gets here. There is a last commit in elasticsearch-filter-plugin adding this total.hits to metadata.

> <https://github.com/logstash-plugins/logstash-filter-elasticsearch/commit/0966efc70fe9dc39af2dff2460bf40171f4cfe72>

---

<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 11, 2018, 4:26pm UTC](https://discuss.elastic.co/t/hits-total-in-elasticsearch-filter-plugin/148342/4 "2018-10-11T16:26:06Z")

</div>

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