Is there a way to make automated CREATED_AT date field?

(Alex Smirnov) #1

We do a lot of updating of the same documents and would be absolutely awesome to have a way for us to tell when the document was originally created. Our processing scripts push data to elasticsearch whenever new changes have been detected, however, we don't ever know in the processing scripts if the document had been previously pushed to Elasticsearch.

Having this datetime field automatically created and populate value just on the initial document create would allow us to generate many types of Date Histogram - driven reports.

Has anyone ever successfully been able to get this implemented in elasticsearch?

(Mark Walkom) #2

Is this what you want?

(Nik Everett) #3

The update API let's you send the document to insert if it doesn't exist.
If you add the current time to that that should get you pretty far.

(Alex Smirnov) #4

No, this is for mapping _timestamp to a document field value, it doesn't allow to set something like a current time as the default value if this value is not yet set in the document.

(Alex Smirnov) #5

Nik, you probably missed that we cant specify different fields on product create and update. We push same data every time there's a change in the data. We always you full document index and always push ID together with it so it overwrites existing document's data and increments the version

(system) #6