Phrase_suggester java api throwing exception


(anusha) #1

Hi All,

AM using the Phrase_Suggester Using java api as shown:

PhraseSuggestionBuilder phraseBuilder=new PhraseSuggestionBuilder("did-you-mean");
phraseBuilder.field(suggest_field);
phraseBuilder.candidateGenerator(suggest_field);

	SearchResponse response=client.prepareSearch(index).setTypes(type).setSize(0).addSuggestion(phraseBuilder).execute().actionGet();

getting the following exception:

Exception in thread "main" org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [query], all shards failed; shardFailures {[eqvyKeSMQFOkl7tbxmdr5w][ast][0]: SearchParseException[[ast][0]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"suggest":{"did-you-mean":{"phrase":{"field":"id.raw"}}}}]]]; nested: ElasticsearchIllegalArgumentException[The required text option is missing]; }{[eqvyKeSMQFOkl7tbxmdr5w][ast][1]: SearchParseException[[ast][1]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"suggest":{"did-you-mean":{"phrase":{"field":"id.raw"}}}}]]]; nested: ElasticsearchIllegalArgumentException[The required text option is missing]; }{[eqvyKeSMQFOkl7tbxmdr5w][ast][2]: SearchParseException[[ast][2]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"suggest":{"did-you-mean":{"phrase":{"field":"id.raw"}}}}]]]; nested: ElasticsearchIllegalArgumentException[The required text option is missing]; }{[eqvyKeSMQFOkl7tbxmdr5w][ast][3]: SearchParseException[[ast][3]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"suggest":{"did-you-mean":{"phrase":{"field":"id.raw"}}}}]]]; nested: ElasticsearchIllegalArgumentException[The required text option is missing]; }{[eqvyKeSMQFOkl7tbxmdr5w][ast][4]: SearchParseException[[ast][4]: from[-1],size[0]: Parse Failure [Failed to parse source [{"size":0,"suggest":{"did-you-mean":{"phrase":{"field":"id.raw"}}}}]]]; nested: ElasticsearchIllegalArgumentException[The required text option is missing]; }
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:238)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.onFailure(TransportSearchTypeAction.java:184)
at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:565)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

May I know how to rectify this????


(system) #2