Reputation: 3
Suppose I have a word Pavan.I am able to get the data with complete word "Pavan",But when I am searching with "Pav".I am getting empty list.
Upvotes: 0
Views: 1397
Reputation: 433
you can use queryString query ,it does full text search on all the fields or you can also specify the field in which u want to search manually please click this link for more information
@Autowired
private Client client;
BoolQueryBuilder boolqueryBuilder = new BoolQueryBuilder();
boolqueryBuilder.should(QueryBuilders
.queryStringQuery("*"+querystring+"*")
.defaultOperator(Operator.AND).analyzeWildcard(true));
SearchResponse response = client.prepareSearch("your index name")
.setQuery(boolqueryBuilder).setExplain(true).get();
Upvotes: 1