Elastic Bulk API - ID substitution


(Steve Wall) #1

I am trying to use the Bulk API with two types: Teams and Players. So here is my sample bulk request:

POST demo/_bulk
{"index": {"_type": "teams"}
{"team": "Cleveland Cavaliers", "sport": "Basketball"}
{"index": {"_type": "players"}
{"name": "LeBron James", "team_id": "<THE ID FROM THE PREVIOUS INSERT>"}

I want Elastic to assign IDs. I also want to associate LeBron James with the generated _id from the Cleveland Cavaliers insert. Also, you can assume I may have many different teams created/updated and players created/updated in the bulk request.

Is this even possible? If so, how?

Thanks!


(David Pilato) #2

You can't do that AFAIK.


(system) #3