Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Upsert with JEST

Michel Feb 12, 2014 05:19PM EET

Hello,

Is it possible to do an UPSERT with JEST ?

Thanks

Up 5 rated Down
Ferhat Sobay Feb 13, 2014 12:22AM EET Searchly Agent
Hi ,

While updating;

String script = "{\n" +
" \"script\" : \"ctx._source.tags += tag\",\n" +
" \"params\" : {\n" +
" \"tag\" : \"blue\"\n" +
" }\n" +
" \"upsert\" : { + "
" \"tags\" : [\"red\"]" +
" }\n" +
"}";

client.execute(new Update.Builder(script).index("twitter").type("tweet").id("1").build());

You can add upsert to update operation.

Is it the answer you are looking for ?

Ferhat
Up 2 rated Down
Michel Feb 13, 2014 10:04PM EET
Hi Ferhat,

Thanks a lot, it is exactly what I was looking for.
One question more if I may : is it possible to do the same work with a pojo?

Thanks in advance.

Michel
Up -1 rated Down
Ferhat Sobay Feb 13, 2014 10:10PM EET Searchly Agent
Hi Michel,

I think you can not do it with a pojo. If you have a design in your mind, be my guest and open an issue for Jest here; https://github.com/searchbox-io/Jest

BTW we are working for Jest ES 1.0 upgrade which will be ready soon.

Ferhat

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)
support@searchly.com
http://assets02.desk.com/
false
searchboxio
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete