2

I have an index that I would like to track a subset of elements over time. I can get most of the way to what I want with reindex.

However, I can't see a way to change the _id, and because my data is generally unchanging, this causes a problem. The reindex doesn't run every time because, I think, the ids are the same.

One solution would be to create a time-based index. Is this the best solution? Has anyone else solved this problem? Someone already asked this type of question and had the answer of time-based index given. I just wanted to double check, and also see if there is a different approach.

As a cartoonish example, because my data really is pretty stagnant, let's say I am tracking the trees in my yard - type, height, radius, name. I only change this, prompting a new id, when one of those fields changes. But every day at midnight I want a reindex so I can see the height of my trees changing over a year.

P.S. I can't use the tag historical because I lack the rep, if someone has advice on tags for this so I can know better, please let me know!

  • In my opinion, you need to have a different way of identifying a "tree": either you control the `_id` and assing IDs yourself or use a separate field for some sort of different ID. Secondly, your document needs to have a timestamp and, depending, on how much data you have use time-based indices and create new indices when the old one gets too large. Or use the [Rollover API](https://www.elastic.co/guide/en/elasticsearch/reference/5.4/indices-rollover-index.html) to have Elasticsearch do this for you. Then you can use Timelion Kibana plugin or Kibana itself to see the data. – Andrei Stefan May 26 '17 at 07:08
  • Thanks Andrei ... Yes, right now I'm experimenting with reindex and setting routing as the timestamp. We have our own home made way of displaying results stored in elasticsearch which is driving the desire for historical data in one index vs many. But otherwise Kibana would be a great way to display the results. – WhensMyNextTrip May 26 '17 at 14:55
  • I'm hesitant to post this an answer because I would like to test more - but it appears that adding type with a unique value appears to allow me to do what I want. That is, have the same data with the same id go into one index multiple times (every time I take a snapshot), as long as type is unique. Once I test this more I will post this as the answer if it does turn out to be that. – WhensMyNextTrip Jun 05 '17 at 19:30

0 Answers0