You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of query/aggregation/property/suggester and index settings does not allow for custom components.
It could have the following shapes (example for a custom aggregation):
The most direct way is to use raw JSON:
JsonDatapluginAgg = ... // Create a JSON node treevarresult = esClient.search(s -> s
.aggregation("foo", a -> a// The plugins expects the "my-plugin" type// The leading underscore indicates that it's a framework-level// feature and not a builtin "custom" variant (such a variant// exists for example in analyzers)
._custom("my-plugin", pluginAgg)
)
);
varsomeResult = result
.aggregations()
.get("foo")
// Check variant id received from ES and return it as JsonData
._custom("my-plugin")
// Traverse the resulting JsonData tree
.toJson().asJsonObject().getString("foo");
Additionally, if you want to enforce strong typing guarantees in requests and make it easier to traverse responses, you can define classes to map the plugin's JSON structures to. In the example below each class is a POJO that implements a specific extension point defined in the Java API client, and has a ExtensionId annotation indicating the variant name in the JSON payloads:
@ExtensionId("my-plugin")
classMyPluginAggimplementsAggregationExtension {
...
}
@ExtensionId("my-plugin")
classMyPluginAggResultimplementsAggregateExtension {
...
}
MyPluginAggpluginAgg = newMyPluginAgg(...);
varresult = esClient.search(s -> s
.aggregation("foo", pluginAgg)
);
varsomeResult = result
.aggregations()
.get("foo")
// Deserialize and downcast to target class
._custom(MyPluginAggResult.class)
.foo();
The text was updated successfully, but these errors were encountered:
Description
The current implementation of query/aggregation/property/suggester and index settings does not allow for custom components.
It could have the following shapes (example for a custom aggregation):
The most direct way is to use raw JSON:
Additionally, if you want to enforce strong typing guarantees in requests and make it easier to traverse responses, you can define classes to map the plugin's JSON structures to. In the example below each class is a POJO that implements a specific extension point defined in the Java API client, and has a
ExtensionId
annotation indicating the variant name in the JSON payloads:The text was updated successfully, but these errors were encountered: