# Make the elasticsearch-input return only one hit

**URL:** <https://discuss.elastic.co/t/make-the-elasticsearch-input-return-only-one-hit/241146>\
**Category:** Logstash\
**Created:** [July 14, 2020, 2:10pm UTC](https://discuss.elastic.co/t/make-the-elasticsearch-input-return-only-one-hit/241146 "2020-07-14T14:10:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alessio\_Creo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alessio_creo/32/43381_2.png) [@Alessio\_Creo](https://discuss.elastic.co/u/Alessio_Creo)\
**Post date:** [July 14, 2020, 2:10pm UTC](https://discuss.elastic.co/t/make-the-elasticsearch-input-return-only-one-hit/241146/1 "2020-07-14T14:10:20Z")

</div>

Hi,

I'm trying to use Logstash to ingest just one hit from an Elasticsearch index.

This is my input configuration

```auto
input{
 elasticsearch{
     hosts=>["logmgrappa.risorse.int:9200","logmgrappb.risorse.int:9200","logmgrappc.risorse.int:9200","logmgrappd.risorse.int:9200"]
     index=>"index*"
     query=> '{"size":1,"query":{"query_string":{"query":"action: ERRORE* AND \"AddDocumentWithCategory\""}}}'
     size=>1
     schedule=> "* * * * *"
     ssl=>true
     ca_file=>"/path/to/cert.pem"
     user=>"***"
     password=>"***"
 }
}

```

But Logstash continue to return all the documents that match the query.

Can someone help me?

Thanks a lot.

---

<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:** [August 11, 2020, 2:10pm UTC](https://discuss.elastic.co/t/make-the-elasticsearch-input-return-only-one-hit/241146/2 "2020-08-11T14:10:31Z")

</div>

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