question: public List < Map < String , Object > > query ( final String indexName , final String q , final Operator operator , final int offset , final int count ) { assert count > 1 ; SearchRequestBuilder request = elasticsearchClient . prepareSearch ( indexName ) . setQuery ( QueryBuilders . multiMatchQuery ( q , "_all" ) . operator ( operator ) . zeroTermsQuery ( ZeroTermsQuery . ALL ) ) . setFrom ( offset ) . setSize ( count ) ; SearchResponse response = request . execute ( ) . actionGet ( ) ; SearchHit [ ] hits = response . getHits ( ) . getHits ( ) ; ArrayList < Map < String , Object > > result = new ArrayList < Map < String , Object > > ( ) ; for ( SearchHit hit : hits ) { Map < String , Object > map = hit . getSource ( ) ; result . add ( map ) ; } return result ; }
target:  Query with a string and boundaries. The string is supposed to be something that the user types in without a technical syntax. The mapping of the search terms into the index can be different according to a search type. Please see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html. A better way to do this would be the usage of a cursor. See the delete method to find out how cursors work.