Reputation: 23277
I've updated to elasticsearch java library version 5.2.0.
In 2.x,
SearchRequestBuilder.addField()
in order to add a field to the search request. Nevertheless, It seems to be replaced. I've written the available methods intellisense is showing me. Which of them do I need to pick?
addDocValueField
addFieldDataField
addScriptField
addStoredField
storedFields
fields
SearchRequestBuilder.setNoFields
is also removed. Which would be the alternative?Code:
return AggregationBuilders
.terms(this.getName())
.field(this.getName())
.script(new Script(
ScriptType.FILE,
"painless",
"year",
ImmutableMap.of("field", this.getName())
)
);
As you can see I setting field
as script parameter. Nevertheless, I don't quite understand how to get it from script code.
Thanks.
Upvotes: 0
Views: 416
Reputation: 217564
When in doubt, go to the source
setFetchSource(String[] includes, String[] excludes)
insteadsetFetchSource(false)
insteadaddScriptField()
Upvotes: 1