Updating date fields not working

I have a document that I am trying to update and it contains a date. If the source gets updated (in a RDBMS) then I am trying to update the document in elasticsearch.

The document, ID 1, is like this:

    {
        '@timestamp': '2019-09-12T10:00:00',
        'created_time': '2019-09-12T10:00:00',
        'updated_time': '2019-09-12T10:00:00',
        'fname': 'joe',
        'lname': 'smyth'
    }

The update doc, also ID 1, looks like:

    {
        '@timestamp': '2019-09-12T10:00:00',
        'created_time': '2019-09-12T10:00:00',
        'updated_time': '2019-09-12T11:30:00',
        'fname': 'joe',
        'lname': 'smyth'
    }

If I do an insert (PUT /index/1) and replace the entire document, the version is incremented BUT the update_time field is NOT changed.
If I do an update (POST /index/_update/1) then nothing is updated (result is noop).

What gives? Are dates NON-updateable?

Just a follow-up note on this, I did some more testing and found that if I change lname to smith and also change updated_time then, as expected lname is properly updated. However, updated_time is still NOT updated. Both methods (index and update) result in the update of lname but NOT updated_time.

I was able to print the result of the update and with only the date in the update command (updated_time), as such:

{'doc': {'updated_time': '2019-09-15T22:55:26.079445'}}

The result is:

{'_index': 'index', '_type': 'doc', '_id': '999999', '_version': 5, 
'result': 'noop', '_shards': {'total': 0, 'successful': 0, 'failed': 0}}

can you please share a fully reproducible example including index creation, document indexing and updating along with the elasticsearch version you are using? Thank you!

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