Parent specification in elasticsearch for first no

2019-09-09 16:26发布

问题:

I am using the _bulk api for indexing my data. I have a parent field for every document except the first document.

Normally my documents will have the following meta-data:

{"index":{"_id":"11111", "parent": "00000"}}

What should I specify in the parent field for the first document.

Should I leave the parent field blank?

{"index":{"_id":"00000", "parent": ""}}

Or should I not include the parent field at all?

{"index":{"_id":"00000"}}

回答1:

You simply don't include the parent property at all in your first document, which should act as the parent document for all other documents.