-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Changes from 4 commits
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 fe11a26
cover more test cases and take ownership of exists yaml tests
talevy fae51f5
more tests
talevy e7d8efd
more fixes
talevy ff1024d
fix enrich test
talevy 99d4240
add empty unit tests
talevy 3d9fb12
add license header
talevy 136a2cf
moar
talevy d7f2279
singletonmap
talevy ad4a4bd
List.of -> Arrays.asList
talevy c954df7
refactor spatial-extras to geo
nknize f6d68f6
Merge branch 'master' into spatial-extras
nknize 3daf046
spotless apply
nknize e45d92c
added TestGeoShapeFieldMapperPlugin to PinnedQueryBuilderTests
nknize e93f6a0
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy 4329d0e
fix checkstyle
talevy 40ce9d7
fix percolator query test
talevy 508b175
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy 64c0bea
try to make Percolator test happy
talevy 558d32d
make gradle happy
talevy 252d8e1
fix ShapeQueryBuilderTests
talevy 4ccb497
no client-only nodes in percolator tests
talevy dbc9414
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy f1a4136
stop using smile in percolator test, no valid UTF8
talevy 61f2b13
fix unsused imports
talevy 917e538
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy be57a80
Merge remote-tracking branch 'elastic/master' into spatial-extras
talevy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
esplugin { | ||
description 'Placeholder plugin for spatial features in ES. only registers geo-shape field mapper for now' | ||
classname 'org.elasticsearch.spatial.SpatialExtrasPlugin' | ||
talevy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
40 changes: 40 additions & 0 deletions
40
modules/spatial-extras/src/main/java/org/elasticsearch/spatial/SpatialExtrasPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.spatial; | ||
|
||
import org.elasticsearch.index.mapper.AbstractGeometryFieldMapper; | ||
import org.elasticsearch.index.mapper.GeoShapeFieldMapper; | ||
import org.elasticsearch.index.mapper.Mapper; | ||
import org.elasticsearch.plugins.MapperPlugin; | ||
import org.elasticsearch.plugins.Plugin; | ||
|
||
import java.util.Collections; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
public class SpatialExtrasPlugin extends Plugin implements MapperPlugin { | ||
|
||
@Override | ||
public Map<String, Mapper.TypeParser> getMappers() { | ||
Map<String, Mapper.TypeParser> mappers = new LinkedHashMap<>(); | ||
mappers.put(GeoShapeFieldMapper.CONTENT_TYPE, new AbstractGeometryFieldMapper.TypeParser()); | ||
return Collections.unmodifiableMap(mappers); | ||
talevy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...al-extras/src/test/java/org/elasticsearch/spatial/SpatialExtrasClientYamlTestSuiteIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package org.elasticsearch.spatial; | ||
|
||
import com.carrotsearch.randomizedtesting.annotations.Name; | ||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory; | ||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; | ||
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; | ||
|
||
/** Runs yaml rest tests */ | ||
public class SpatialExtrasClientYamlTestSuiteIT extends ESClientYamlSuiteTestCase { | ||
|
||
public SpatialExtrasClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) { | ||
super(testCandidate); | ||
} | ||
|
||
@ParametersFactory | ||
public static Iterable<Object[]> parameters() throws Exception { | ||
return ESClientYamlSuiteTestCase.createParameters(); | ||
} | ||
} | ||
|
59 changes: 59 additions & 0 deletions
59
modules/spatial-extras/src/test/resources/rest-api-spec/test/geo_shape/10_basic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
setup: | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
location: | ||
type: geo_shape | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: 1 | ||
body: | ||
location: "POINT (1.0 1.0)" | ||
|
||
- do: | ||
indices.refresh: {} | ||
|
||
--- | ||
"Test Geo Shape Query": | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
body: | ||
query: | ||
bool: | ||
filter: | ||
geo_shape: | ||
location: | ||
shape: | ||
type: Envelope | ||
coordinates: | ||
- [-80.0, 34.0] | ||
- [43, -13.0] | ||
relation: within | ||
|
||
- match: | ||
hits.total: 1 | ||
|
||
- 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} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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