Skip to content

Commit

Permalink
chores: bumps to ES 8.17.0 (#506)
Browse files Browse the repository at this point in the history
* Compatibility fixes for ES 8.17.0

* Update LtrQueryTests.java

Test works when uncommenting this, so I'd rather keep the test.

* Update LtrQueryTests.java

fixing the indentation I did wrong.

---------

Co-authored-by: Daniel Wrigley <[email protected]>
  • Loading branch information
agam20821mg and wrigleyDan authored Jan 28, 2025
1 parent 06581f5 commit b82ca8b
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 26 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ltrVersion = 1.5.9
elasticsearchVersion = 8.15.5
luceneVersion = 9.11.1
elasticsearchVersion = 8.17.0
luceneVersion = 9.12.0
ow2Version = 8.0.1
antlrVersion = 4.5.1-1
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ public double execute(ExplanationHolder explainationHolder) {
public boolean needs_score() {
return false;
}

@Override
public boolean needs_termStats() {
return false;
}
};

return context.factoryClazz.cast(factory);
Expand Down Expand Up @@ -284,6 +289,11 @@ public double execute(ExplanationHolder explainationHolder ) {
public boolean needs_score() {
return false;
}

@Override
public boolean needs_termStats() {
return false;
}
};

return context.factoryClazz.cast(factory);
Expand Down Expand Up @@ -321,6 +331,11 @@ public double execute(ExplanationHolder explanation) {
public boolean needs_score() {
return false;
}

@Override
public boolean needs_termStats() {
return false;
}
};

return context.factoryClazz.cast(factory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.CountDown;
import org.elasticsearch.index.query.BoolQueryBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.threadpool.ThreadPool;
Expand All @@ -38,7 +38,7 @@
import java.util.List;

public class TransportCacheStatsAction extends TransportNodesAction<CachesStatsNodesRequest, CachesStatsNodesResponse,
TransportCacheStatsAction.CachesStatsNodeRequest, CachesStatsNodeResponse> {
TransportCacheStatsAction.CachesStatsNodeRequest, CachesStatsNodeResponse, CachesStatsAction> {
private final Caches caches;

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.settings.Settings;
Expand All @@ -39,7 +39,7 @@
import java.util.List;

public class TransportClearCachesAction extends TransportNodesAction<ClearCachesNodesRequest, ClearCachesNodesResponse,
TransportClearCachesAction.ClearCachesNodeRequest, ClearCachesNodeResponse> {
TransportClearCachesAction.ClearCachesNodeRequest, ClearCachesNodeResponse, ClearCachesAction> {
private final Caches caches;

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.tasks.Task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.transport.TransportService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.elasticsearch.action.support.nodes.TransportNodesAction;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ThreadPool;
Expand All @@ -23,7 +23,7 @@
import java.util.stream.Collectors;

public class TransportLTRStatsAction extends
TransportNodesAction<LTRStatsNodesRequest, LTRStatsNodesResponse, LTRStatsNodeRequest, LTRStatsNodeResponse> {
TransportNodesAction<LTRStatsNodesRequest, LTRStatsNodesResponse, LTRStatsNodeRequest, LTRStatsNodeResponse, LTRStatsAction> {

private final LTRStats ltrStats;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.o19s.es.ltr.action.ListStoresAction.ListStoresActionResponse;
import com.o19s.es.ltr.feature.store.index.IndexFeatureStore;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.search.MultiSearchRequestBuilder;
import org.elasticsearch.action.search.MultiSearchResponse;
Expand All @@ -35,7 +36,7 @@
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.core.Tuple;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.injection.guice.Inject;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
Expand Down Expand Up @@ -73,7 +74,10 @@ public TransportListStoresAction(TransportService transportService,
protected void masterOperation(Task task, ListStoresActionRequest request, ClusterState state,
ActionListener<ListStoresActionResponse> listener) throws Exception {
String[] names = indexNameExpressionResolver.concreteIndexNames(state,
new ClusterStateRequest().indices(IndexFeatureStore.DEFAULT_STORE, IndexFeatureStore.STORE_PREFIX + "*"));
new ClusterStateRequest(
TimeValue.timeValueMinutes(1)).indices(
IndexFeatureStore.DEFAULT_STORE, IndexFeatureStore.STORE_PREFIX + "*")
);
final MultiSearchRequestBuilder req = client.prepareMultiSearch();
final List<Tuple<String, Integer>> versions = new ArrayList<>();
Stream.of(names)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.util.concurrent.ThreadContext;

import org.elasticsearch.core.TimeValue;
import java.util.Arrays;
import java.util.Locale;
import java.util.function.Supplier;
Expand Down Expand Up @@ -38,7 +38,7 @@ public String get() {

private String getAggregateStoresStatus() {
String[] names = indexNameExpressionResolver.concreteIndexNames(clusterService.state(),
new ClusterStateRequest().indices(
new ClusterStateRequest(TimeValue.timeValueMinutes(1)).indices(
IndexFeatureStore.DEFAULT_STORE, IndexFeatureStore.STORE_PREFIX + "*"));
return Arrays.stream(names)
.filter(IndexFeatureStore::isIndexStore)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.aggregations.AggregationBuilders;
Expand Down Expand Up @@ -67,7 +68,7 @@ public StoreStatsSupplier(Client client, ClusterService clusterService, IndexNam
@Override
public Map<String, Map<String, Object>> get() {
String[] names = indexNameExpressionResolver.concreteIndexNames(clusterService.state(),
new ClusterStateRequest().indices(
new ClusterStateRequest(TimeValue.timeValueMinutes(1)).indices(
IndexFeatureStore.DEFAULT_STORE, IndexFeatureStore.STORE_PREFIX + "*"));
final MultiSearchRequestBuilder requestBuilder = client.prepareMultiSearch();
List<String> indices = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.elasticsearch.index.query.TermQueryBuilder;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.AbstractQueryTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;

import java.io.IOException;
import java.util.Collection;
Expand All @@ -35,7 +34,7 @@
public class ExplorerQueryBuilderTests extends AbstractQueryTestCase<ExplorerQueryBuilder> {
// TODO: Remove the TestGeoShapeFieldMapperPlugin once upstream has completed the migration.
protected Collection<Class<? extends Plugin>> getPlugins() {
return asList(LtrQueryParserPlugin.class, TestGeoShapeFieldMapperPlugin.class);
return asList(LtrQueryParserPlugin.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptType;
import org.elasticsearch.test.AbstractQueryTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -45,7 +44,7 @@ public class LtrQueryBuilderTests extends AbstractQueryTestCase<LtrQueryBuilder>

// TODO: Remove the TestGeoShapeFieldMapperPlugin once upstream has completed the migration.
protected Collection<Class<? extends Plugin>> getPlugins() {
return Arrays.asList(LtrQueryParserPlugin.class, TestGeoShapeFieldMapperPlugin.class);
return Arrays.asList(LtrQueryParserPlugin.class);
}

private static final String simpleModel = "## LambdaMART\\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.elasticsearch.index.query.functionscore.FunctionScoreQueryBuilder;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.AbstractQueryTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.junit.Before;

import java.io.IOException;
Expand All @@ -67,7 +66,7 @@ public class StoredLtrQueryBuilderTests extends AbstractQueryTestCase<StoredLtrQ

// TODO: Remove the TestGeoShapeFieldMapperPlugin once upstream has completed the migration.
protected Collection<Class<? extends Plugin>> getPlugins() {
return Arrays.asList(TestPlugin.class, TestGeoShapeFieldMapperPlugin.class);
return Arrays.asList(TestPlugin.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.AbstractQueryTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.junit.runner.RunWith;

import java.io.IOException;
Expand All @@ -57,7 +56,7 @@ public class ValidatingLtrQueryBuilderTests extends AbstractQueryTestCase<Valida

// TODO: Remove the TestGeoShapeFieldMapperPlugin once upstream has completed the migration.
protected Collection<Class<? extends Plugin>> getPlugins() {
return asList(LtrQueryParserPlugin.class, TestGeoShapeFieldMapperPlugin.class);
return asList(LtrQueryParserPlugin.class);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.elasticsearch.index.query.SearchExecutionContext;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.AbstractQueryTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;

import java.io.IOException;
import java.util.Collection;
Expand All @@ -19,7 +18,7 @@
public class TermStatQueryBuilderTests extends AbstractQueryTestCase<TermStatQueryBuilder> {
// TODO: Remove the TestGeoShapeFieldMapperPlugin once upstream has completed the migration.
protected Collection<Class<? extends Plugin>> getPlugins() {
return asList(LtrQueryParserPlugin.class, TestGeoShapeFieldMapperPlugin.class);
return asList(LtrQueryParserPlugin.class);
}

@Override
Expand Down

0 comments on commit b82ca8b

Please sign in to comment.