Get values with specific characters

(JavaES) #1

Hi Team,

how to get the matches in the index with specific words..

Actually i have polyurethane in my elastic search ,

I want to get this word in otput if the user types more than two words in search box ..

If he types pol i want polyurethane to populate

M using the following code ,how i need to modify my code

//QueryBuilder builder = new QueryBuilder();
final TimeValue timeValue = TimeValue.timeValueMillis(10000);

	try {
		// getting suggestion for SAYT search term
		CompletionSuggestionBuilder suggestionsBuilder = new CompletionSuggestionBuilder("complete");
		//JSONArray blackListArr = new JSONArray();
		builder.must(QueryBuilders.matchQuery("suggestion", queryTerm).operator(MatchQueryBuilder.Operator.AND).fuzziness(Fuzziness.ONE));
		SearchRequestBuilder srb = ClientInstance.getInstance().getClient().prepareSearch(index).setTypes(type).setTimeout(timeValue).setQuery(builder);
		SearchHits hitss = null;
		SearchHit hittss = null;
		SearchHits totalhitss = null;
		SearchResponse response = srb.execute().actionGet();
		total = response.getHits().getTotalHits();

(system) #2