phillro/node-elasticsearch-client

_parent routing when adding an index item?

Closed this issue · 1 comments

This is more of a documentation issue but Im not sure how to create this type of request using the client:

curl -XPUT localhost:9200/posts/rating/1?parent=1 -d '{ "user_id": 1234, "rating": 4}'

(this works)

If I use:

{
   _parent: 1,
   user_id: 1234,
   rating: 4
}

I get {"error":"RoutingMissingException[routing is required for ....

I guess Im missing how to specify this type of routing .index method.

So after digging through the source its the, possibly badly named, "options" parameter you need to add "parent" to, which then gets expanded into the query parameters of the index query.