Adding Timestamp to each document added in Elastic

2019-09-06 07:04发布

How can I create an Index and Mapping with the timestamp field so each added document will include a timestamp by default.

I am using NEST (C#) but I just cant figure out how to do it.

I am also using Kibana but it seems not to work properly because I am missing the timestamp field.

Also, after I am adding this field, is there any way I can 'confirm' the field is added? can I query this field?

Thanks!

1条回答
我命由我不由天
2楼-- · 2019-09-06 07:17

When you index a document a _timestamp field can be automatically generated for each document.

To enable the timestamp, add the following to your mapping:

{
    "my_mapping" : {
        "_timestamp" : { "enabled" : true, "store" : true }
    }
}
查看更多
登录 后发表回答