Doesn`t visible after refresh?

I encountered a problem that can not search a doc after refresh.
here is my operation:
1 client.prepareIndex(idx, idx, id).setSource(doc).execute();
2 client.admin().indices()
.prepareRefresh(idx)
.get();
3 client.prepareGet(idx, idx, id).get() (i get null);

Very strange as you don't even need to call refresh before calling GET by id.

I'd say that you have a bug somewhere in your code.

Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

you means if i put a doc then i use 'GET' can find it immediately? 'GET' doesn`t like 'Search' need open segment?

Yes.

i have resolved this, just replace "execute()" with "get()" ,like this "client.prepareIndex(idx, idx, id).setSource(doc).get()"

Argh. I missed it in your first post. Indeed call execute().actionGet() or better just call get().

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