Why did the elastic search java api ignore our query restrictions?
I am using this Code:
client.prepareSearch("test").addSort("dateUpdated",SortOrder.DESC) .setSearchType(SearchType.DFS_QUERY_AND_FETCH) .setIndices("reach") .setTypes(types) .setQuery(QueryBuilders.queryString(queryString)) .setFrom(0).setSize(2).setExplain(true) .execute() .actionGet()
The client is a remote client There are five results in total. Based on my above results, I only hope two results can come back But all five came back If I set the size to 0, there is no reply (as expected) what am I missing? I think I misunderstood something about origin / size My query string is just "Name: *" Any help is greatly appreciated!
Solution
This is another explanation of how to set the size without disturbing the number of tiles
"Query and fetch" is the fastest search type, but it encountered the problem of obtaining the specified size for each fragment Using "query then fetch" will solve the problem If not specified, it is also the default search type
More about search types: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-search-type.html