Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new geo module and migrate geo_shape registration #53562

Merged
merged 27 commits into from
Apr 7, 2020
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aab920f
Create new spatial-extras module and migrate geo_shape registration
talevy Mar 13, 2020
fe11a26
cover more test cases and take ownership of exists yaml tests
talevy Mar 13, 2020
fae51f5
more tests
talevy Mar 13, 2020
e7d8efd
more fixes
talevy Mar 13, 2020
ff1024d
fix enrich test
talevy Mar 13, 2020
99d4240
add empty unit tests
talevy Mar 13, 2020
3d9fb12
add license header
talevy Mar 13, 2020
136a2cf
moar
talevy Mar 13, 2020
d7f2279
singletonmap
talevy Mar 13, 2020
ad4a4bd
List.of -> Arrays.asList
talevy Mar 13, 2020
c954df7
refactor spatial-extras to geo
nknize Mar 18, 2020
f6d68f6
Merge branch 'master' into spatial-extras
nknize Mar 18, 2020
3daf046
spotless apply
nknize Mar 18, 2020
e45d92c
added TestGeoShapeFieldMapperPlugin to PinnedQueryBuilderTests
nknize Mar 23, 2020
e93f6a0
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy Mar 31, 2020
4329d0e
fix checkstyle
talevy Mar 31, 2020
40ce9d7
fix percolator query test
talevy Mar 31, 2020
508b175
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy Apr 1, 2020
64c0bea
try to make Percolator test happy
talevy Apr 1, 2020
558d32d
make gradle happy
talevy Apr 2, 2020
252d8e1
fix ShapeQueryBuilderTests
talevy Apr 2, 2020
4ccb497
no client-only nodes in percolator tests
talevy Apr 2, 2020
dbc9414
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy Apr 2, 2020
f1a4136
stop using smile in percolator test, no valid UTF8
talevy Apr 3, 2020
61f2b13
fix unsused imports
talevy Apr 3, 2020
917e538
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy Apr 3, 2020
be57a80
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy Apr 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cover more test cases and take ownership of exists yaml tests
  • Loading branch information
talevy committed Mar 13, 2020
commit fe11a26684d2e834877eaa3aca7e51dac3501384
Original file line number Diff line number Diff line change
@@ -30,11 +30,11 @@
import org.elasticsearch.index.query.RankFeatureQueryBuilder.ScoreFunction;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.AbstractQueryTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import static org.hamcrest.CoreMatchers.instanceOf;
@@ -52,7 +52,7 @@ protected void initializeAdditionalMappings(MapperService mapperService) throws

@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return Collections.singleton(MapperExtrasPlugin.class);
return List.of(MapperExtrasPlugin.class, TestGeoShapeFieldMapperPlugin.class);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is room to pull the TestGeoShapeFieldMapperPlugin to the parent test class and inherited by those that need it or need to extend to include more plugins. I could see it stay either way since it is fairly low impact and the dependency is expected to go away

talevy marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
Original file line number Diff line number Diff line change
@@ -22,15 +22,16 @@
import org.elasticsearch.join.ParentJoinPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class ChildrenTests extends BaseAggregationTestCase<ChildrenAggregationBuilder> {

@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return Collections.singleton(ParentJoinPlugin.class);
return List.of(ParentJoinPlugin.class, TestGeoShapeFieldMapperPlugin.class);
}

@Override
Original file line number Diff line number Diff line change
@@ -20,17 +20,18 @@
package org.elasticsearch.join.aggregations;

import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.elasticsearch.join.ParentJoinPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.search.aggregations.BaseAggregationTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;

public class ParentTests extends BaseAggregationTestCase<ParentAggregationBuilder> {

@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return Collections.singleton(ParentJoinPlugin.class);
return List.of(ParentJoinPlugin.class, TestGeoShapeFieldMapperPlugin.class);
}

@Override
Original file line number Diff line number Diff line change
@@ -56,12 +56,14 @@
import org.elasticsearch.search.sort.FieldSortBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.test.AbstractQueryTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.test.VersionUtils;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
@@ -85,7 +87,7 @@ public class HasChildQueryBuilderTests extends AbstractQueryTestCase<HasChildQue

@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return Collections.singletonList(ParentJoinPlugin.class);
return List.of(ParentJoinPlugin.class, TestGeoShapeFieldMapperPlugin.class);
}

@Override
Original file line number Diff line number Diff line change
@@ -44,12 +44,14 @@
import org.elasticsearch.search.sort.FieldSortBuilder;
import org.elasticsearch.search.sort.SortOrder;
import org.elasticsearch.test.AbstractQueryTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.elasticsearch.test.VersionUtils;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
@@ -70,7 +72,7 @@ public class HasParentQueryBuilderTests extends AbstractQueryTestCase<HasParentQ

@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return Collections.singletonList(ParentJoinPlugin.class);
return List.of(ParentJoinPlugin.class, TestGeoShapeFieldMapperPlugin.class);
}

@Override
Original file line number Diff line number Diff line change
@@ -38,11 +38,12 @@
import org.elasticsearch.join.ParentJoinPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.test.AbstractQueryTestCase;
import org.elasticsearch.test.TestGeoShapeFieldMapperPlugin;
import org.hamcrest.Matchers;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.hamcrest.CoreMatchers.containsString;
@@ -61,7 +62,7 @@ public class ParentIdQueryBuilderTests extends AbstractQueryTestCase<ParentIdQue

@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return Collections.singletonList(ParentJoinPlugin.class);
return List.of(ParentJoinPlugin.class, TestGeoShapeFieldMapperPlugin.class);
}

@Override
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ setup:
indices.refresh: {}

---
"Geo Shape Query":
"Test Geo Shape Query":

- do:
search:
@@ -44,3 +44,16 @@ setup:

- match:
hits.hits.0._id: "1"

---
"Test Exists Query on geo_shape field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: location

- match: {hits.total: 1}
Original file line number Diff line number Diff line change
@@ -18,8 +18,6 @@ setup:
type: date
geo_point:
type: geo_point
geo_shape:
type: geo_shape
ip:
type: ip
keyword:
@@ -59,9 +57,6 @@ setup:
boolean: true
date: "2017-01-01"
geo_point: [0.0, 20.0]
geo_shape:
type: "point"
coordinates: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
@@ -87,9 +82,6 @@ setup:
boolean: false
date: "2017-01-01"
geo_point: [0.0, 20.0]
geo_shape:
type: "point"
coordinates: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
@@ -115,9 +107,6 @@ setup:
boolean: true
date: "2017-01-01"
geo_point: [0.0, 20.0]
geo_shape:
type: "point"
coordinates: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
@@ -157,8 +146,6 @@ setup:
geo_point:
type: geo_point
doc_values: false
geo_shape:
type: geo_shape
ip:
type: ip
doc_values: false
@@ -210,9 +197,6 @@ setup:
boolean: true
date: "2017-01-01"
geo_point: [0.0, 20.0]
geo_shape:
type: "point"
coordinates: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
@@ -238,9 +222,6 @@ setup:
boolean: false
date: "2017-01-01"
geo_point: [0.0, 20.0]
geo_shape:
type: "point"
coordinates: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
@@ -266,9 +247,6 @@ setup:
boolean: true
date: "2017-01-01"
geo_point: [0.0, 20.0]
geo_shape:
type: "point"
coordinates: [0.0, 20.0]
ip: "192.168.0.1"
keyword: "foo"
byte: 1
@@ -318,8 +296,6 @@ setup:
type: date
geo_point:
type: geo_point
geo_shape:
type: geo_shape
ip:
type: ip
keyword:
@@ -404,19 +380,6 @@ setup:

- match: {hits.total: 3}

---
"Test exists query on mapped geo_shape field":
- do:
search:
rest_total_hits_as_int: true
index: test
body:
query:
exists:
field: geo_shape

- match: {hits.total: 3}

---
"Test exists query on mapped ip field":
- do:
@@ -718,19 +681,6 @@ setup:

- match: {hits.total: 0}

---
"Test exists query on unmapped geo_shape field":
- do:
search:
rest_total_hits_as_int: true
index: test-unmapped
body:
query:
exists:
field: geo_shape

- match: {hits.total: 0}

---
"Test exists query on unmapped ip field":
- do:
@@ -939,19 +889,6 @@ setup:

- match: {hits.total: 0}

---
"Test exists query on geo_shape field in empty index":
- do:
search:
rest_total_hits_as_int: true
index: test-empty
body:
query:
exists:
field: geo_shape

- match: {hits.total: 0}

---
"Test exists query on ip field in empty index":
- do:
@@ -1160,18 +1097,6 @@ setup:

- match: {hits.total: 3}

---
"Test exists query on mapped geo_shape field with no doc values":
- do:
search:
rest_total_hits_as_int: true
index: test-no-dv
body:
query:
exists:
field: geo_shape

- match: {hits.total: 3}

---
"Test exists query on mapped ip field with no doc values":