QueryStringQueryBuilder is used to search string where as MultiMatchQueryBuilder/MatchQueryBuilder is used to match the exact value in the specific field, if exact match is there then and only you will get document. Whereas QueryStringQueryBuilder provides search operation you can perform search operation here.
So first decide, do you want exact match or want to search string ?
Could you try this for the search operation ?
SearchRequest searchRequest = new SearchRequest("indexA","indexB");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
/**
* Multi fields to be searched in
*/
Map<String,Float> fields = new HashMap<String, Float>();
fields.put("column1_From_IndexA", 0.0F);
fields.put("column2_From_IndexA", 0.0F);
fields.put("column1_From_IndexB", 0.0F);
QueryStringQueryBuilder builder = QueryBuilders.queryStringQuery("searchString").fields(fields);
searchSourceBuilder.query(builder);
searchRequest.source(searchSourceBuilder);
SearchResponse response = client.search(searchRequest, RequestOptions.DEFAULT);
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.