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


Is it possible to do an UPSERT with JEST ?


Up 6 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 ?

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.

Up 0 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;

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


Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found