Skip to content

Commit

Permalink
Merge pull request #7 from clement-tourriere/7.5
Browse files Browse the repository at this point in the history
Migrate plugin to elasticsearch 7.5.1
  • Loading branch information
5k4nd authored Feb 12, 2020
2 parents a1827c2 + a32c2a8 commit e69702d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 27 deletions.
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Fixes integTests for 7.5.1 => https://github.com/elastic/elasticsearch/issues/49787#issuecomment-562720655
import org.elasticsearch.gradle.testclusters.TestClustersPlugin
import org.elasticsearch.gradle.testclusters.TestClustersRegistry

buildscript {
repositories {
mavenLocal()
Expand Down Expand Up @@ -43,3 +47,9 @@ checkstyleTest.enabled = true
dependencyLicenses.enabled = true

thirdPartyAudit.enabled = true

// Fixes integTests for 7.5.1 => https://github.com/elastic/elasticsearch/issues/49787#issuecomment-562720655
TestClustersRegistry registry = project.rootProject.extensions.create("testClustersRegistry", TestClustersRegistry)
TestClustersPlugin.configureClaimClustersHook(project.gradle, registry)
TestClustersPlugin.configureStartClustersHook(project.gradle, registry)
TestClustersPlugin.configureStopClustersHook(project.gradle, registry)
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
es_version = 7.4.0
plugin_version = 7.4.0.0
es_version = 7.5.1
plugin_version = 7.5.1.0
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 12 additions & 17 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.elasticsearch.common.xcontent.ObjectParser;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.AggregationBuilder;
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
import org.elasticsearch.search.aggregations.AggregatorFactory;
Expand All @@ -19,7 +20,6 @@
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.aggregations.support.ValuesSourceParserHelper;
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
import org.elasticsearch.search.internal.SearchContext;

import java.io.IOException;
import java.util.Map;
Expand Down Expand Up @@ -178,7 +178,8 @@ public int shardSize() {
}

@Override
protected ValuesSourceAggregatorFactory<ValuesSource.GeoPoint> innerBuild(SearchContext context,
protected ValuesSourceAggregatorFactory<ValuesSource.GeoPoint> innerBuild(
QueryShardContext context,
ValuesSourceConfig<ValuesSource.GeoPoint> config, AggregatorFactory parent, Builder subFactoriesBuilder)
throws IOException {
int shardSize = this.shardSize;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.opendatasoft.elasticsearch.search.aggregations.bucket.geopointclustering;

import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory;
Expand All @@ -26,7 +27,7 @@ public class GeoPointClusteringAggregatorFactory extends ValuesSourceAggregatorF

GeoPointClusteringAggregatorFactory(
String name, ValuesSourceConfig<GeoPoint> config, int precision, double radius, double ratio,
int requiredSize, int shardSize, SearchContext context,
int requiredSize, int shardSize, QueryShardContext context,
AggregatorFactory parent, AggregatorFactories.Builder subFactoriesBuilder, Map<String, Object> metaData
) throws IOException {
super(name, config, context, parent, subFactoriesBuilder, metaData);
Expand All @@ -39,11 +40,12 @@ public class GeoPointClusteringAggregatorFactory extends ValuesSourceAggregatorF

@Override
protected Aggregator createUnmapped(
SearchContext searchContext,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData
) throws IOException {
final InternalAggregation aggregation = new InternalGeoPointClustering(name, radius, ratio, requiredSize,
Collections.<InternalGeoPointClustering.Bucket> emptyList(), pipelineAggregators, metaData);
return new NonCollectingAggregator(name, context, parent, pipelineAggregators, metaData) {
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metaData) {
@Override
public InternalAggregation buildEmptyAggregation() {
return aggregation;
Expand All @@ -53,13 +55,13 @@ public InternalAggregation buildEmptyAggregation() {

@Override
protected Aggregator doCreateInternal(
final GeoPoint valuesSource, Aggregator parent, boolean collectsFromSingleBucket,
final GeoPoint valuesSource, SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException {
if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, context, parent);
return asMultiBucketAggregator(this, searchContext, parent);
}
return new GeoPointClusteringAggregator(
name, factories, valuesSource, precision, radius, ratio, requiredSize, shardSize, context, parent,
name, factories, valuesSource, precision, radius, ratio, requiredSize, shardSize, searchContext, parent,
pipelineAggregators, metaData);
}

Expand Down

0 comments on commit e69702d

Please sign in to comment.