I can see that for non-bulk PUT operations this functionality exists, for the _id field, using "op_type" as explained in the API.
So I tried this URL:
https://localhost:9200/my_index/_bulk/?op_type=create
and also
https://localhost:9200/my_index/_bulk?op_type=create
Both failed:
"error": {
"reason": "request [/my_index/_bulk/] contains unrecognized parameter: [op_type]",
Is there any way to accomplish this? The request body is the bulk string itself and the method is POST.
>Solution :
You just need to use create instead of index in _bulk
DELETE test
POST test/_bulk?refresh
{"create": {"_id": "foo"}}
{"test": 1}
{"create": {"_id": "foo"}}
{"test": 2}
POST test/_search
{
"query": {
"match_all": {}
}
}