Cannot find symbol IMMEDIATE

code in v2.3.3
IndexResponse idxResp=getIndex().setId(documentDto.getId().toString()).setSource(source).setRefresh(true).execute().actionGet();
While upgrading from ES v2.3.3 to ES v5.6.2, I am facing the error: "Could not resolve symbol : variable IMMEDIATE" at the following line of code-
code for v5.6.2-
IndexResponse idxResp=getIndex().setId(documentDto.getId().toString()).setSource(source).setRefresh(IMMEDIATE).execute().actionGet();

I have even tried setRefreshPolicy(RefreshPolicy.IMMEDIATE), but it didn't work.
Please Help.

What do you mean by "it did not work"?

BTW you should move to the Rest Client as the TransportClient is now deprecated.
Also, I'd recommend using the latest 5.x version or event better move to 6.x...

By it did not work, I mean that the error "IMMEDIATE variable could not be found" still persists even after using setRefrreshPolicy(RefreshPolicy.IMMEDIATE).
During initial upgrades I was trying with Rest client but then I was facing some issue so I decided to stay with Transport client as suggested by Tim Vernum in this post-

Is it a compilation problem or happening at runtime ?

Asking that because I can see this Enum here:

So you should be able to access to WriteRequest.RefreshPolicy.IMMEDIATE.

Also

.setRefreshPolicy("true")

Should have the same effect.

It was a compile time error and yes this has been resolved by using .setRefreshPolicy("true").
Thank you very much for your time and effort. :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.