ElasticSearch: Inserting an Element with a _parent field using JEST -
I am using elastic search for an application to store and search the data. Because it is also important to find relationships in my special case, I have recently changed the structure of my data and I am now using the parent field. ()
I have already designed the search query, which works perfectly well. However, I have a problem when putting a new hair entry in my database.
It should work in this way:
Without the parent field, when I wanted to get it
$ curl - XPUT 'http: // localhost: 9200 / data / child / 1' -d '
I used the Zest API to put the data in such a way:
Client.execute (new index builder (payload). Index ("data"). Type ("child"). Build ());
When I want to receive it:
$ curl -XPOST localhost: 9200 / data / child? Parent = 154121-d '
How can I implement it using Zest-API?
I have already searched an answer on Google / Stackoverflow, but come up with a solution.
Thanks in advance! :)
Finally I found a solution! :)
It is possible to provide a parameter for the request. Correct line of code to get:
$ curl -XPOST localhost: 9200 / data / child = parent = 154121-d '
This will be achieved with:
client.execute (new index builder (payload). Index ("data"). Type ("child") SetParameter ("parent", "154121 ") .build ());
Hope I can help someone with this answer in the future! :)
Comments
Post a Comment