setVersion(false) on SearchRequestBuilder Not Working

Are you sure that you are getting multiple versions of the same document?
Is it possible that you are getting different documents (with different
values of _index, _type or _id fields) that just look similar?

Elasticsearch stores only the last version. setVersion doesn't control
saving/retrieving multiple versions; it just indicates if the version value
should be returned or not.

On Wednesday, April 11, 2012 11:39:20 AM UTC-4, Ed Brown VSTI wrote:

Hello,
I'm using the SearchRequestBuilder to perform a search and I noticed I'm
getting multiple versions of the same document returned. I then used
setVersion(false), recompiled and ran the code again and I got the same
result.
A code snippet follows:

=== Start Snippet ===

QueryBuilder qb = QueryBuilders.fieldQuery(idField,
idValue);
SearchRequestBuilder srb = tclient.prepareSearch(index);
srb.setVersion(false);

srb.setSearchType(SearchType.QUERY_AND_FETCH);
srb.setQuery(qb);
srb.addFields(documentFields);
srb.addField("_id");

ListenableActionFuture laf = srb.execute();

SearchResponse resp = laf.actionGet();

SearchHits hits = resp.getHits();

=== End Snippet ===

What gives? I'm trying to do a query and then an update. With multiple
versions being returned, I'm getting nasty results.

Ed Brown