I am trying to add documents, according to elastic search documents, we can add document, even if we dont provide id... See Here
I am trying to add a document even if it doesnt have any ID. in elastic search, how can i do that? My current code looks like this
var params = _.defaults({}, {
index: index,
type: type, //'customer'
id: data.id || null,
body: data
})
debug(params)
return this.client.create(params);
The above code gives this error
{ "error": "Unable to build a path with those params. Supply at least index, type, id" }
Any hint would help, thanks
With the create
call you MUST provide an id.
If you are not sure if an ID will be present in your data
, then you can use the client.index()
function instead. using that function, ES will auto-generate an ID if none is provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With