Hi all...
So I'm trying to use Elastic Search, but am having some difficulties.
The latest one is, in code like this:
SearchRequestBuilder builder = client.prepareSearch(index);
builder = builder.setSearchType(SearchType.DFS_QUERY_AND_FETCH);
builder = builder.setQuery(new
QueryStringQueryBuilder(queryString));
builder = builder.setFrom(startIndex);
builder = builder.setSize(maxResults);
builder = builder.setExplain(true);
ListenableActionFuture future =
builder.execute();
response = future.actionGet(MAX_WAIT_MILLIS);
SearchHits hits = response.getHits();
hits.getTotalHits() is some reasonable number
However, hits.getHits().length is always BIGGER than maxResults.
From the documentation, it looks like I"m supposed to just get, at
most, maxResults hits back, but I'm always getting more than that
back.
Does anyone know why that might be happening? Am I doing something
wrong here?
Hi,
Query and fetch would return size*number of shards results. (
Elasticsearch Platform — Find real-time answers at scale | Elastic).
hari
On Mon, Jul 11, 2011 at 1:18 PM, TimOnGmail timbessie@gmail.com wrote:
Hi all...
So I'm trying to use Elastic Search, but am having some difficulties.
The latest one is, in code like this:
SearchRequestBuilder builder = client.prepareSearch(index);
builder = builder.setSearchType(SearchType.DFS_QUERY_AND_FETCH);
builder = builder.setQuery(new
QueryStringQueryBuilder(queryString));
builder = builder.setFrom(startIndex);
builder = builder.setSize(maxResults);
builder = builder.setExplain(true);
ListenableActionFuture future =
builder.execute();
response = future.actionGet(MAX_WAIT_MILLIS);
SearchHits hits = response.getHits();
hits.getTotalHits() is some reasonable number
However, hits.getHits().length is always BIGGER than maxResults.
From the documentation, it looks like I"m supposed to just get, at
most, maxResults hits back, but I'm always getting more than that
back.
Does anyone know why that might be happening? Am I doing something
wrong here?
Ahhh, thanks Hari!
On Jul 11, 1:36 am, Hari Shankar shaan.h...@gmail.com wrote:
Hi,
Query and fetch would return size*number of shards results. (Elasticsearch Platform — Find real-time answers at scale | Elastic).
hari
On Mon, Jul 11, 2011 at 1:18 PM, TimOnGmail timbes...@gmail.com wrote:
Hi all...
So I'm trying to use Elastic Search, but am having some difficulties.
The latest one is, in code like this:
SearchRequestBuilder builder = client.prepareSearch(index);
builder = builder.setSearchType(SearchType.DFS_QUERY_AND_FETCH);
builder = builder.setQuery(new
QueryStringQueryBuilder(queryString));
builder = builder.setFrom(startIndex);
builder = builder.setSize(maxResults);
builder = builder.setExplain(true);
ListenableActionFuture future =
builder.execute();
response = future.actionGet(MAX_WAIT_MILLIS);
SearchHits hits = response.getHits();
hits.getTotalHits() is some reasonable number
However, hits.getHits().length is always BIGGER than maxResults.
From the documentation, it looks like I"m supposed to just get, at
most, maxResults hits back, but I'm always getting more than that
back.
Does anyone know why that might be happening? Am I doing something
wrong here?