Using document _id


#1

When I insert document to index Is it necessary to set valid _id for this document? I know that this document will not be updated in an index.


(Mark Walkom) #2

Just let Elasticsearch create a random one for you :slight_smile:


#3

So document _id has valid value all the time. However when I checked document's _id in Kibana I didn't see any values of _id until I assign them directly


(Mark Walkom) #4

I'm not sure how that can be, every document gets assigned an _id automatically upon indexing into Elasticsearch.


(Ruan Bekker) #5

@ybegus, did you verify that the time when the document was ingested, matches up with the Time Range filter in Kibana?


(Christian Dahlqvist) #6

You should be able to see the document ID in the discover application in Kibana. It is usually the second field when a document is expanded.


#7

Yes I did. So I saw my documents in Discover page in Kibana but _id fields were empty until I assigned values to _id in meta part of bulk function. As I understood it’s not necessary for user assign any values to _id if there is no plan to update documents, doesn’t it?


#8

I agree with you. It’s easy to check. Actually I didn’t use _id field in meta-message.


(Christian Dahlqvist) #9

Every document has to have an an _id set. Please show a screenshot where it is empty.


#10

I have changed my Node.js code before I wrote about that and cleaned logs because I am in debugging process. I returned code back (removed _id from meta-data) to reproduce this behavior. However I see _id has value all the time like in a copy of one row from Discover page (see below). So I could not reproduce this behavior.

June 29th 2018, 19:22:14.335

ts:
June 29th 2018, 19:22:14.335
opID:
close
trqID:
10
pmID:
4294967306
vpID:
2
retCode:
0
read_bytes:
0
write_bytes:
17,600
fd:
1,455,553
user_name:
/developers/john
tpath:
/john-prj/vda/gendataTest/john_1601.txt
_id:
xMr-TGQBVw6i1FM-9AG8
_type:
log
_index:
icm-vda-20180629
_score:
-
Thank you for cooperation!


(system) #11

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