# Cannot find symbol IMMEDIATE

**URL:** <https://discuss.elastic.co/t/cannot-find-symbol-immediate/173919>\
**Category:** Elasticsearch\
**Created:** [March 26, 2019, 12:05pm UTC](https://discuss.elastic.co/t/cannot-find-symbol-immediate/173919 "2019-03-26T12:05:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![utkarsh](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@utkarsh](https://discuss.elastic.co/u/utkarsh)\
**Post date:** [March 26, 2019, 12:05pm UTC](https://discuss.elastic.co/t/cannot-find-symbol-immediate/173919/1 "2019-03-26T12:05:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 26, 2019, 1:06pm UTC](https://discuss.elastic.co/t/cannot-find-symbol-immediate/173919/2 "2019-03-26T13:06:53Z")

</div>

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...

---

<div class="post-metadata">

**Author:** ![utkarsh](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@utkarsh](https://discuss.elastic.co/u/utkarsh)\
**Post date:** [March 26, 2019, 1:47pm UTC](https://discuss.elastic.co/t/cannot-find-symbol-immediate/173919/3 "2019-03-26T13:47:09Z")

</div>

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-

> [@Xpack with elasticsearch java rest client](https://discuss.elastic.co/t/xpack-with-elasticsearch-java-rest-client/160379):
>
> Updating elastic to 5.x from 2.x needs shield security to be replaced with x-pack security and java Transport client with java Rest-High-Level client/Low-Level-Client. Where can i find the information on how to use xpack with elasticsearch java rest client for version 5.6.2 and If no such information is present then how do i do it?(Because earlier I was providing shield username and password to java Transport client in my code and now with java Rest client coming into picture, i am not able to …

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 26, 2019, 2:04pm UTC](https://discuss.elastic.co/t/cannot-find-symbol-immediate/173919/4 "2019-03-26T14:04:49Z")

</div>

Is it a compilation problem or happening at runtime ?

Asking that because I can see this Enum here:

> <https://github.com/elastic/elasticsearch/blob/5.6/core/src/main/java/org/elasticsearch/action/support/WriteRequest.java#L73>

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

Also

```auto
.setRefreshPolicy("true")

```

Should have the same effect.

---

<div class="post-metadata">

**Author:** ![utkarsh](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@utkarsh](https://discuss.elastic.co/u/utkarsh)\
**Post date:** [March 27, 2019, 8:47am UTC](https://discuss.elastic.co/t/cannot-find-symbol-immediate/173919/5 "2019-03-27T08:47:16Z")

</div>

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. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 24, 2019, 8:47am UTC](https://discuss.elastic.co/t/cannot-find-symbol-immediate/173919/6 "2019-04-24T08:47:26Z")

</div>

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