Indexing child docs using bulk api

Hi there,
I need to reindex my data, and I am using the parent child
relations in my index, and now i need to use the bulk api for reindexing
the data. I studied the bulk api
http://www.elasticsearch.org/guide/reference/api/bulk.html

but I could not understand how can I index child doc using this api, as I
need to provide the parent id with the request.

Please give some idea how to deal with it...

Thanks
Narinder Kaur

--

To clarify, you're not reindexing the parent documents? Is there any chance
that you're setting the id as a function of the contents of the document?
Or one of the fields?

On Wednesday, December 12, 2012 9:12:12 PM UTC-8, Narinder Kaur wrote:

Hi there,
I need to reindex my data, and I am using the parent child
relations in my index, and now i need to use the bulk api for reindexing
the data. I studied the bulk api
http://www.elasticsearch.org/guide/reference/api/bulk.html

but I could not understand how can I index child doc using this api, as I
need to provide the parent id with the request.

Please give some idea how to deal with it...

Thanks
Narinder Kaur

--

If you need to index child documents via the bulk api, you can just
put the parent uid in the bulk index items. The child document bulk
item should look like this:
{ "index" : { "_index" : "[index]", "_type" : "[child-type]", "_id" :
"[uid]", "parent", "[parent-uid]" } } // index request for a child
document
{ "field1" : "value1" } // the actual document soure
... // rest of bulk request. Also each line in the bulk request needs a newline.

When indexing the child document, you need to know to what parent it
belongs to. So you need to fetch it from somewhere (your db / storage
or ES).

Martijn

On 13 December 2012 23:15, Dan Lecocq dan@seomoz.org wrote:

To clarify, you're not reindexing the parent documents? Is there any chance
that you're setting the id as a function of the contents of the document? Or
one of the fields?

On Wednesday, December 12, 2012 9:12:12 PM UTC-8, Narinder Kaur wrote:

Hi there,
I need to reindex my data, and I am using the parent child
relations in my index, and now i need to use the bulk api for reindexing the
data. I studied the bulk api
http://www.elasticsearch.org/guide/reference/api/bulk.html

but I could not understand how can I index child doc using this api, as I
need to provide the parent id with the request.

Please give some idea how to deal with it...

Thanks
Narinder Kaur

--

--
Met vriendelijke groet,

Martijn van Groningen

--