# Logstash control records

**URL:** <https://discuss.elastic.co/t/logstash-control-records/41251>\
**Category:** Logstash\
**Created:** [February 9, 2016, 8:31am UTC](https://discuss.elastic.co/t/logstash-control-records/41251 "2016-02-09T08:31:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![chicco\_95](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chicco\_95](https://discuss.elastic.co/u/chicco_95)\
**Post date:** [February 9, 2016, 8:31am UTC](https://discuss.elastic.co/t/logstash-control-records/41251/1 "2016-02-09T08:31:13Z")

</div>

hi all,  
I've got an issue with logstash, hiw can I perform a check on specific indexes in elastic search, so that i can assure the record I am loading (in the pipeline) doesn't already exist on elastic search?

thank you

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 9, 2016, 8:55am UTC](https://discuss.elastic.co/t/logstash-control-records/41251/2 "2016-02-09T08:55:39Z")

</div>

Querying ES for every event isn't very efficient. I suggest you instead set the document id yourself based on one or more of the fields in each event instead of having ES autogenerated that id for you. That way, if the same event turns up again the origin document in ES would get updated automatically.

---

<div class="post-metadata">

**Author:** ![chicco\_95](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chicco\_95](https://discuss.elastic.co/u/chicco_95)\
**Post date:** [February 9, 2016, 9:02am UTC](https://discuss.elastic.co/t/logstash-control-records/41251/3 "2016-02-09T09:02:52Z")

</div>

Yes , i use the personal id , but i configured indexes with NAME + YEAR + MONTH , so when i load an event load an event , sometimes is duplicated , because it is already present .

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 9, 2016, 9:07am UTC](https://discuss.elastic.co/t/logstash-control-records/41251/4 "2016-02-09T09:07:47Z")

</div>

Are you really storing time-series data where timestamp-based indexes are relevant? If you explain the background more it'll be easier to suggest a good solution.

---

<div class="post-metadata">

**Author:** ![chicco\_95](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chicco\_95](https://discuss.elastic.co/u/chicco_95)\
**Post date:** [February 9, 2016, 10:42am UTC](https://discuss.elastic.co/t/logstash-control-records/41251/5 "2016-02-09T10:42:06Z")

</div>

i storing my indexes with name+year+month , when i upload an event , logstash inserts it in the latest index, without checking the previous indexes.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 9, 2016, 10:50am UTC](https://discuss.elastic.co/t/logstash-control-records/41251/6 "2016-02-09T10:50:14Z")

</div>

Yes, I understand _what_ you're doing. What I don't understand is _why_. It sounds like that data you're indexing isn't time-series data, because time-series data typically doesn't need to be updated after a few days like you're data does. If the data isn't time-series data I suggest you stop treating it as such, and the problem you currently have would go away.

---

<div class="post-metadata">

**Author:** ![chicco\_95](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chicco\_95](https://discuss.elastic.co/u/chicco_95)\
**Post date:** [February 9, 2016, 10:54am UTC](https://discuss.elastic.co/t/logstash-control-records/41251/7 "2016-02-09T10:54:46Z")

</div>

I'm doing it for storing data

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 9, 2016, 11:01am UTC](https://discuss.elastic.co/t/logstash-control-records/41251/8 "2016-02-09T11:01:09Z")

</div>

Yes, of course you're storing data. That doesn't answer the "why" question. Last chance: Why is it necessary to treat this data as time-series data when it doesn't seem to _be_ time-series data?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 9, 2016, 12:35pm UTC](https://discuss.elastic.co/t/logstash-control-records/41251/9 "2016-02-09T12:35:44Z")

</div>

You should be able to use the [elasticsearch filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-elasticsearch.html), by the way.

---

<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:** [July 6, 2017, 5:12am UTC](https://discuss.elastic.co/t/logstash-control-records/41251/10 "2017-07-06T05:12:30Z")

</div>


