Skip to content

Setting globalText property on SuggestBuilder instead of the #text property on each SuggestionBuilder returns null from SearchResponse#getSuggest #23340

@etay2000

Description

@etay2000

Elasticsearch version: 5.2.1

Description of the problem including expected versus actual behavior:

Calling the setGlobalText method on SuggestBuilder should be a shortcut to setting the text() property on each SuggestionBuilder added to the SuggestBuilder. Currently setting just the global text causes the Suggest object returned by SearchResponse to be null.

Steps to reproduce:
`
String searchText = "foo";
SuggestBuilder suggestBuilder = new SuggestBuilder();
suggestBuilder.setGlobalText(searchText);

SuggestionBuilder<?> suggestionBuilder = SuggestBuilders.completionSuggestion("fieldName");
// suggestionBuilder.text(searchText);
// uncomment the line above and the searchResponse#getResponse will exist as expected
suggestBuilder.addSuggestion("suggestion-name", suggestionBuilder);

searchResponse.getSuggest() // This is null when only the global text is set.
`
The Suggest instance should not be null if the global text is set on the SuggestBuilder.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions