Skip to content

Commit b34c2ca

Browse files
authored
Merge pull request #25 from opendatasoft/7.17
BugFix multi aggregations with PathHierarchy DateHierarchy
2 parents 388bb6a + f79fc28 commit b34c2ca

File tree

7 files changed

+102
-16
lines changed

7 files changed

+102
-16
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ 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.17.1.0/pathhierarchy-aggregation-7.17.1.0.zip"`
18+
`bin/plugin --install path_hierarchy --url "https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.17.1.1/pathhierarchy-aggregation-7.17.1.1.zip"`
1919

2020
Build
2121
-----
22-
Compatible with Java version from 15 to 17
22+
Compatible with Java version 11
2323

2424
Development Environment Setup
2525
------------
@@ -329,7 +329,7 @@ Installation
329329
The first 3 digits of plugin version is Elasticsearch versioning. The last digit is used for plugin versioning under an elasticsearch version.
330330

331331
To install it, launch this command in Elasticsearch directory replacing the url by the correct link for your Elasticsearch version (see table)
332-
`./bin/elasticsearch-plugin install https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.17.1.0/pathhierarchy-aggregation-7.17.1.0.zip`
332+
`./bin/elasticsearch-plugin install https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.17.1.1/pathhierarchy-aggregation-7.17.1.1.zip`
333333

334334
| elasticsearch version | plugin version | plugin url |
335335
| --------------------- | -------------- | ---------- |
@@ -351,7 +351,7 @@ To install it, launch this command in Elasticsearch directory replacing the url
351351
| 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 |
352352
| 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 |
353353
| 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.1 | 7.17.1.0 | https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.17.1.0/pathhierarchy-aggregation-7.17.1.0.zip |
354+
| 7.17.1 | 7.17.1.1 | https://github.com/opendatasoft/elasticsearch-aggregation-pathhierarchy/releases/download/v7.17.1.1/pathhierarchy-aggregation-7.17.1.1.zip |
355355

356356
License
357357
-------

docker-compose.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
version: "3.7"
22

3+
networks:
4+
es-network:
5+
36
services:
47
elasticsearch-plugin-debug:
58
build:
@@ -15,4 +18,15 @@ services:
1518
ports:
1619
- "9200:9200"
1720
# DEBUG
18-
- "5005:5005"
21+
- "5005:5005"
22+
networks:
23+
- es-network
24+
25+
kibana:
26+
image: docker.elastic.co/kibana/kibana:7.17.1
27+
environment:
28+
ELASTICSEARCH_HOSTS: http://elasticsearch-plugin-debug:9200/
29+
ports:
30+
- "5602:5601"
31+
networks:
32+
- es-network

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM docker.elastic.co/elasticsearch/elasticsearch:7.17.1 AS elasticsearch-plugin-debug
22

3-
COPY /build/distributions/pathhierarchy-aggregation-7.17.1.0.zip /tmp/pathhierarchy-aggregation-7.17.1.0.zip
4-
RUN ./bin/elasticsearch-plugin install file:/tmp/pathhierarchy-aggregation-7.17.1.0.zip
3+
COPY /build/distributions/pathhierarchy-aggregation-7.17.1.1.zip /tmp/pathhierarchy-aggregation-7.17.1.1.zip
4+
RUN ./bin/elasticsearch-plugin install file:/tmp/pathhierarchy-aggregation-7.17.1.1.zip

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
es_version = 7.17.1
2-
plugin_version = 7.17.1.0
2+
plugin_version = 7.17.1.1

src/main/java/org/opendatasoft/elasticsearch/search/aggregations/bucket/DateHierarchyAggregationBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,16 +373,16 @@ protected XContentBuilder doXContentBody(XContentBuilder builder, Params params)
373373
return builder.endObject();
374374
}
375375

376-
/**
377-
* Used for caching requests, amongst other things.
378-
*/
379376
@Override
380377
public int hashCode() {
381-
return Objects.hash(interval, order, minDocCount, bucketCountThresholds, timeZone);
378+
return Objects.hash(super.hashCode(), interval, order, minDocCount, bucketCountThresholds, timeZone);
382379
}
383380

384381
@Override
385382
public boolean equals(Object obj) {
383+
if (this == obj) return true;
384+
if (obj == null || getClass() != obj.getClass()) return false;
385+
if (!super.equals(obj)) return false;
386386
DateHierarchyAggregationBuilder other = (DateHierarchyAggregationBuilder) obj;
387387
return Objects.equals(interval, other.interval)
388388
&& Objects.equals(order, other.order)

src/main/java/org/opendatasoft/elasticsearch/search/aggregations/bucket/PathHierarchyAggregationBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,16 +320,16 @@ protected XContentBuilder doXContentBody(XContentBuilder builder, Params params)
320320
return builder.endObject();
321321
}
322322

323-
/**
324-
* Used for caching requests, amongst other things.
325-
*/
326323
@Override
327324
public int hashCode() {
328-
return Objects.hash(separator, minDepth, maxDepth, depth, order, minDocCount, bucketCountThresholds);
325+
return Objects.hash(super.hashCode(), separator, minDepth, maxDepth, depth, order, minDocCount, bucketCountThresholds);
329326
}
330327

331328
@Override
332329
public boolean equals(Object obj) {
330+
if (this == obj) return true;
331+
if (obj == null || getClass() != obj.getClass()) return false;
332+
if (!super.equals(obj)) return false;
333333
PathHierarchyAggregationBuilder other = (PathHierarchyAggregationBuilder) obj;
334334
return Objects.equals(separator, other.separator)
335335
&& Objects.equals(minDepth, other.minDepth)
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
setup:
2+
- do:
3+
indices.create:
4+
index: filesystem
5+
body:
6+
settings:
7+
number_of_shards: 1
8+
number_of_replicas: 0
9+
mappings:
10+
properties:
11+
path1:
12+
type: keyword
13+
path2:
14+
type: keyword
15+
16+
- do:
17+
cluster.health:
18+
wait_for_status: green
19+
20+
---
21+
"Test with filesystem arborescence":
22+
- do:
23+
index:
24+
index: filesystem
25+
id: 1
26+
body: { "path1": "/My documents/Spreadsheets/Budget_2013.xls", "path2": "/My documents/Spreadsheets/Budget_2014.xls" }
27+
28+
- do:
29+
index:
30+
index: filesystem
31+
id: 2
32+
body: { "path1": "/My documents/Spreadsheets/Budget_2014.xls", "path2": "/My documents/Spreadsheets/Budget_2013.xls" }
33+
34+
- do:
35+
indices.refresh: {}
36+
37+
38+
# basic test
39+
- do:
40+
search:
41+
rest_total_hits_as_int: true
42+
body: {
43+
"size" : 0,
44+
"aggs": {
45+
"_path1_agg": {
46+
"path_hierarchy": {
47+
"field": "path1",
48+
"order": {
49+
"_key": "asc"
50+
},
51+
"shard_size": 100,
52+
"size": 20000,
53+
"min_doc_count": 0
54+
}
55+
},
56+
"_path2_agg": {
57+
"path_hierarchy": {
58+
"field": "path2",
59+
"order": {
60+
"_key": "asc"
61+
},
62+
"shard_size": 100,
63+
"size": 20000,
64+
"min_doc_count": 0
65+
}
66+
}
67+
}
68+
}
69+
70+
- match: { aggregations._path1_agg.buckets.0.key: "My documents" }
71+
72+
- match: { aggregations._path2_agg.buckets.0.key: "My documents" }

0 commit comments

Comments
 (0)