Skip to content

Commit 69e6e7e

Browse files
authored
Merge pull request #23 from opendatasoft/7.17
Release version 7.17.0.0
2 parents 567dbc2 + 6b4d1a8 commit 69e6e7e

28 files changed

+676
-344
lines changed

README.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,31 @@ This is a multi bucket aggregation.
1515
Installation
1616
------------
1717

18-
`bin/plugin --install path_hierarchy --url "https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.6.0.0/pathhierarchy-aggregation-7.6.0.0.zip"`
18+
`bin/plugin --install path_hierarchy --url "https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.17.0.0/pathhierarchy-aggregation-7.17.0.0.zip"`
1919

2020
Build
2121
-----
22-
Requires Java 12
22+
Compatible with Java version from 15 to 17
23+
24+
Development Environment Setup
25+
------------
26+
27+
Build the plugin using gradle:
28+
29+
`./gradlew build`
30+
31+
OR
32+
33+
`./gradlew assemble` (to avoid tests)
34+
35+
Then the following command will start a dockerized ES and will install the previously built plugin:
36+
37+
`
38+
docker-compose up
39+
`
40+
41+
42+
> NOTE: In `docker-compose.yml` you can uncomment the debug env and attach a REMOTE JVM on `*:5005` to debug the plugin.
2343
2444
Path hierarchy aggregation
2545
--------------------------
@@ -291,6 +311,7 @@ GET /calendar/_search?size=0
291311
"aggs": {
292312
"tree": {
293313
"date_hierarchy": {
314+
"field": "date",
294315
"interval": "days",
295316
"order": {
296317
"_key": "asc"
@@ -305,12 +326,10 @@ GET /calendar/_search?size=0
305326
Installation
306327
------------
307328

308-
Plugin versions are available for (at least) all minor versions of Elasticsearch since 6.0.
309-
310329
The first 3 digits of plugin version is Elasticsearch versioning. The last digit is used for plugin versioning under an elasticsearch version.
311330

312331
To install it, launch this command in Elasticsearch directory replacing the url by the correct link for your Elasticsearch version (see table)
313-
`./bin/elasticsearch-plugin install https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.6.0.0/pathhierarchy-aggregation-7.6.0.0.zip`
332+
`./bin/elasticsearch-plugin install https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.17.0.0/pathhierarchy-aggregation-7.17.0.0.zip`
314333

315334
| elasticsearch version | plugin version | plugin url |
316335
| --------------------- | -------------- | ---------- |
@@ -330,7 +349,9 @@ To install it, launch this command in Elasticsearch directory replacing the url
330349
| 7.4.2 | 7.4.2.0 | https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.4.2.0/pathhierarchy-aggregation-7.4.2.0.zip |
331350
| 7.5.1 | 7.5.1.0 | https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.5.1.0/pathhierarchy-aggregation-7.5.1.0.zip |
332351
| 7.6.0 | 7.6.0.0 | https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.6.0.0/pathhierarchy-aggregation-7.6.0.0.zip |
333-
352+
| 7.10.2 | 7.10.2.0 | https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.10.2.0/pathhierarchy-aggregation-7.10.2.0.zip |
353+
| 7.16.3 | 7.16.3.0 | https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.16.3.0/pathhierarchy-aggregation-7.16.3.0.zip |
354+
| 7.17.0 | 7.17.0.0 | https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.17.0.0/pathhierarchy-aggregation-7.17.0.0.zip |
334355

335356
License
336357
-------

build.gradle

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ buildscript {
22
repositories {
33
mavenLocal()
44
mavenCentral()
5-
jcenter()
65
}
76

87
dependencies {
98
classpath "org.elasticsearch.gradle:build-tools:${es_version}"
109
}
1110
}
1211

12+
repositories {
13+
mavenLocal()
14+
mavenCentral()
15+
}
16+
1317
group = 'org.elasticsearch.plugin'
1418
version = "${plugin_version}"
1519

1620
apply plugin: 'java'
1721
apply plugin: 'idea'
1822
apply plugin: 'elasticsearch.esplugin'
19-
20-
// license of this project
21-
licenseFile = rootProject.file('LICENSE')
22-
noticeFile = rootProject.file('README.md')
23-
23+
apply plugin: 'elasticsearch.yaml-rest-test'
2424

2525
esplugin {
2626
name 'pathhierarchy-aggregation'
@@ -31,15 +31,7 @@ esplugin {
3131
}
3232

3333
dependencies {
34-
compile "org.elasticsearch:elasticsearch:${es_version}"
35-
}
36-
37-
// Skip license headers check
38-
licenseHeaders.enabled = false
39-
40-
// Use elasticsearch checkstyle rules
41-
checkstyleTest.enabled = true
42-
43-
dependencyLicenses.enabled = true
44-
45-
thirdPartyAudit.enabled = true
34+
implementation "org.elasticsearch:elasticsearch:${es_version}"
35+
yamlRestTestImplementation "org.elasticsearch.test:framework:${es_version}"
36+
yamlRestTestImplementation "org.apache.logging.log4j:log4j-core:2.17.1"
37+
}

docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: "3.7"
2+
3+
services:
4+
elasticsearch-plugin-debug:
5+
build:
6+
context: .
7+
dockerfile: docker/Dockerfile
8+
target: elasticsearch-plugin-debug
9+
environment:
10+
- discovery.type=single-node
11+
# NO DEBUG
12+
# - ES_JAVA_OPTS=-Xms512m -Xmx512m
13+
# DEBUG
14+
- ES_JAVA_OPTS=-Xms512m -Xmx512m -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005
15+
ports:
16+
- "9200:9200"
17+
# DEBUG
18+
- "5005:5005"

docker/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM docker.elastic.co/elasticsearch/elasticsearch:7.17.0 AS elasticsearch-plugin-debug
2+
3+
COPY /build/distributions/pathhierarchy-aggregation-7.17.0.0.zip /tmp/pathhierarchy-aggregation-7.17.0.0.zip
4+
RUN ./bin/elasticsearch-plugin install file:/tmp/pathhierarchy-aggregation-7.17.0.0.zip

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
es_version = 7.6.0
2-
plugin_version = 7.6.0.0
1+
es_version = 7.17.0
2+
plugin_version = 7.17.0.0

gradle/wrapper/gradle-wrapper.jar

508 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
2929
set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
3235
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
3336
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
3437

@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
3740

3841
set JAVA_EXE=java.exe
3942
%JAVA_EXE% -version >NUL 2>&1
40-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4144

4245
echo.
4346
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -51,7 +54,7 @@ goto fail
5154
set JAVA_HOME=%JAVA_HOME:"=%
5255
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5356

54-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5558

5659
echo.
5760
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -61,28 +64,14 @@ echo location of your Java installation.
6164

6265
goto fail
6366

64-
:init
65-
@rem Get command-line arguments, handling Windows variants
66-
67-
if not "%OS%" == "Windows_NT" goto win9xME_args
68-
69-
:win9xME_args
70-
@rem Slurp the command line arguments.
71-
set CMD_LINE_ARGS=
72-
set _SKIP=2
73-
74-
:win9xME_args_slurp
75-
if "x%~1" == "x" goto execute
76-
77-
set CMD_LINE_ARGS=%*
78-
7967
:execute
8068
@rem Setup the command line
8169

8270
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8371

72+
8473
@rem Execute Gradle
85-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
8675

8776
:end
8877
@rem End local scope for the variables with windows NT shell
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
package org.opendatasoft.elasticsearch.plugin;
22

3-
import java.util.ArrayList;
43
import org.elasticsearch.plugins.Plugin;
54
import org.elasticsearch.plugins.SearchPlugin;
6-
import org.opendatasoft.elasticsearch.search.aggregations.bucket.PathHierarchyAggregationBuilder;
75
import org.opendatasoft.elasticsearch.search.aggregations.bucket.DateHierarchyAggregationBuilder;
8-
import org.opendatasoft.elasticsearch.search.aggregations.bucket.InternalPathHierarchy;
96
import org.opendatasoft.elasticsearch.search.aggregations.bucket.InternalDateHierarchy;
7+
import org.opendatasoft.elasticsearch.search.aggregations.bucket.InternalPathHierarchy;
8+
import org.opendatasoft.elasticsearch.search.aggregations.bucket.PathHierarchyAggregationBuilder;
9+
10+
import java.util.ArrayList;
1011

1112
public class PathHierarchyAggregation extends Plugin implements SearchPlugin {
1213
@Override
1314
public ArrayList<SearchPlugin.AggregationSpec> getAggregations() {
1415
ArrayList<SearchPlugin.AggregationSpec> r = new ArrayList<>();
15-
1616
r.add(
1717
new AggregationSpec(
1818
PathHierarchyAggregationBuilder.NAME,
1919
PathHierarchyAggregationBuilder::new,
20-
PathHierarchyAggregationBuilder::parse)
21-
.addResultReader(InternalPathHierarchy::new)
20+
PathHierarchyAggregationBuilder.PARSER)
21+
.addResultReader(InternalPathHierarchy::new)
22+
.setAggregatorRegistrar(PathHierarchyAggregationBuilder::registerAggregators)
2223
);
23-
2424
r.add(
2525
new AggregationSpec(
2626
DateHierarchyAggregationBuilder.NAME,
2727
DateHierarchyAggregationBuilder::new,
28-
DateHierarchyAggregationBuilder::parse)
28+
DateHierarchyAggregationBuilder.PARSER)
2929
.addResultReader(InternalDateHierarchy::new)
30+
.setAggregatorRegistrar(DateHierarchyAggregationBuilder::registerAggregators)
3031
);
31-
3232
return r;
3333
}
3434
}

0 commit comments

Comments
 (0)