|
|
@@ -58,16 +58,12 @@ import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
|
|
|
import org.elasticsearch.xpack.core.analytics.action.AnalyticsStatsAction;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.Collection;
|
|
|
-import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.function.Consumer;
|
|
|
import java.util.function.Supplier;
|
|
|
|
|
|
-import static java.util.Collections.singletonList;
|
|
|
-
|
|
|
public class AnalyticsPlugin extends Plugin implements SearchPlugin, ActionPlugin, MapperPlugin {
|
|
|
private final AnalyticsUsage usage = new AnalyticsUsage();
|
|
|
|
|
|
@@ -102,7 +98,7 @@ public class AnalyticsPlugin extends Plugin implements SearchPlugin, ActionPlugi
|
|
|
|
|
|
@Override
|
|
|
public List<AggregationSpec> getAggregations() {
|
|
|
- return Arrays.asList(
|
|
|
+ return List.of(
|
|
|
new AggregationSpec(
|
|
|
StringStatsAggregationBuilder.NAME,
|
|
|
StringStatsAggregationBuilder::new,
|
|
|
@@ -138,7 +134,7 @@ public class AnalyticsPlugin extends Plugin implements SearchPlugin, ActionPlugi
|
|
|
|
|
|
@Override
|
|
|
public List<ActionPlugin.ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
|
|
|
- return Arrays.asList(
|
|
|
+ return List.of(
|
|
|
new ActionHandler<>(XPackUsageFeatureAction.ANALYTICS, AnalyticsUsageTransportAction.class),
|
|
|
new ActionHandler<>(XPackInfoFeatureAction.ANALYTICS, AnalyticsInfoTransportAction.class),
|
|
|
new ActionHandler<>(AnalyticsStatsAction.INSTANCE, TransportAnalyticsStatsAction.class)
|
|
|
@@ -147,12 +143,12 @@ public class AnalyticsPlugin extends Plugin implements SearchPlugin, ActionPlugi
|
|
|
|
|
|
@Override
|
|
|
public List<Setting<?>> getSettings() {
|
|
|
- return singletonList(TopMetricsAggregatorFactory.MAX_BUCKET_SIZE);
|
|
|
+ return List.of(TopMetricsAggregatorFactory.MAX_BUCKET_SIZE);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Mapper.TypeParser> getMappers() {
|
|
|
- return Collections.singletonMap(HistogramFieldMapper.CONTENT_TYPE, HistogramFieldMapper.PARSER);
|
|
|
+ return Map.of(HistogramFieldMapper.CONTENT_TYPE, HistogramFieldMapper.PARSER);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -186,12 +182,12 @@ public class AnalyticsPlugin extends Plugin implements SearchPlugin, ActionPlugi
|
|
|
Tracer tracer,
|
|
|
AllocationDeciders allocationDeciders
|
|
|
) {
|
|
|
- return singletonList(usage);
|
|
|
+ return List.of(usage);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
|
|
|
- return Arrays.asList(
|
|
|
+ return List.of(
|
|
|
new NamedWriteableRegistry.Entry(TTestState.class, PairedTTestState.NAME, PairedTTestState::new),
|
|
|
new NamedWriteableRegistry.Entry(TTestState.class, UnpairedTTestState.NAME, UnpairedTTestState::new)
|
|
|
);
|