Commit Graph

195 Commits

Author SHA1 Message Date
Ignacio Vera 63310fd86c
Remove unused geo module (#77016)
Module was used to register geo_shape mapping into the oss distribution.
2021-09-03 07:12:01 +02:00
Ignacio Vera 648a7aefbe
Replace Lucene DataInput/DataOutput with Elasticsearch StreamInput/StreamOutput when reading/writing geo_shape doc values (#76162)
This commit introduces a new ByteArrayStreamInput that allows reusability and random reads.
2021-09-01 07:05:56 +02:00
Rene Groeschke 35ec6f348c
Introduce simple public yaml-rest-test plugin (#76554)
This introduces a basic public yaml rest test plugin that is supposed to be used by external 
elasticsearch plugin authors. This is driven by #76215

- Rename yaml-rest-test to intern-yaml-rest-test
- Use public yaml plugin in example plugins

Co-authored-by: Mark Vieira <portugee@gmail.com>
2021-08-31 08:45:52 +02:00
Ryan Ernst 2bc4eca529
Remove unused recent trial license version from license state (#76692)
* Remove unused recent trial license version from license state

The license state previously used the most recent trial license version
to determine the default security enabled state. Since that no longer
exists, this can be removed from the license state.

* compile

* fix tests

* iter

* more compile
2021-08-19 19:53:16 -04:00
Stuart Tettemer aea8bfffc8
Script: ulong via fields API (#76519)
* Script: ulong via fields API

Exposes unsigned long via the fields API.

Unsigned longs default to java signed longs.  That means the upper range
appears negative.  Consumers should use `Long.compareUnsigned(long, long)`
`Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`
to correctly work with values known to be unsigned long.

Alternatively, users may treat the unsigned long type as `BigInteger` using
the field API, `field('ul').as(Field.BigInteger).getValue(BigInteger.ZERO)`.
```
field('ul').as(Field.BigInteger).getValue(BigInteger.valueOf(1000))
field('ul').getValue(1000L)
```

This change also implements the beginning of the converters for the fields
API.  The following conversions have been added:
```
ulong <-> BigInteger
long <-> BigInteger
double -> BigInteger
String (parsed as long or double) -> BigInteger
double -> long
String (parsed as long or double) -> long
Date (epoch milliseconds) -> long
Nano Date (epoch nanoseconds) -> long
boolean (1L for true, 0L for false) -> long
```
2021-08-17 10:06:28 -05:00
Ignacio Vera 2985f7f6bb
Fix GeoShapeWithDocValuesFieldTypeTests#testFetchVectorTile (#76063)
ignore invalid geometries the same way we are doing it in ArraySourceValueFetcher and
only simplify (multi)polygons if they are valid
2021-08-05 08:13:11 +02:00
Igor Motov 07eaaeb6e4
Remove MVT-specific logic from GeoFormatterFactory (#76049)
GeoFormatterFactory doesn't need to know that the extension points were created
specifically for the purpose of generating vector tiles. We can make it support
an arbitrary formats by moving all MVT-specific logic into formatter itself.

Follow up for #75367
2021-08-04 15:02:50 -10:00
Ignacio Vera e87f05d8b7
mute testFetchVectorTile (#76060) 2021-08-04 09:35:35 +02:00
Ignacio Vera 368e2e0755
Add 'mvt' field type format to geo fields (#75367)
In this commit we extend the Fields API formats for geo data in order to produce vector tiles features directly 
on the data nodes. That helps the vector tile API to reduce the size of the data that needs to pull in order to 
create the answer.
2021-07-28 09:24:54 +02:00
Rory Hunter 944b3f3b56
Fix compiler warnings in :server - part 1 (#75708)
Part of #40366. Fix a number of javac issues when linting is enforced in `server/`.
2021-07-27 19:40:40 +01:00
Ignacio Vera 02c29433d1
Vector tiles: order hits by geometry size by default (#75621)
_mvt end point gives priority to geometries with larger area
2021-07-27 18:34:21 +02:00
Ignacio Vera dcd38779f9
Geometry formatters should be applied to the full array (#75177)
Changes the way we fetch values from source in geo fields so we can format all data in one go.
2021-07-14 16:23:30 +02:00
Ignacio Vera ebe8a9b58f
Alias field does not work with geo_shape query (#74895)
Fixes the resolution of the field name in the geo_shape query.
2021-07-08 07:19:38 +02:00
Luca Cavanna c6641bf00c
Rename ParseContext to DocumentParserContext (#74963)
ParseContext is used to parse documents. It was easily confused with ParserContext (now renamed to MappingParserContext) which is instead used to parse mappings.

To remove any confusion, this commit renames ParseContext to DocumentParserContext and adapts its subclasses accordingly.
2021-07-06 09:15:59 -04:00
Ignacio Vera 0f30c79e4b
Remove legacy geo code from AbstractGeometryQueryBuilder classes (#74741)
removes references to Legacy ShapeParser and ShapeBuilder in AbstractGeometryQueryBuilder classes 
in favour to Geometry and GeometryParser.
2021-07-05 07:31:55 +02:00
Przemyslaw Gomulka 4fa1c8db46
[Rest Api Compatibility] Allow for type in geo shape query (#74553)
Allowing to specify type in geo_shape query. previously removed by #47792
types removal compatible meta #54160
main meta issue #51816
2021-06-30 12:38:24 +02:00
Ignacio Vera cda050de3e
Fix computation of max cells for bounded geohash grid aggregation (#74542)
computation of max cells is actually underestimated so it can lead to an AOOB exception.
2021-06-29 07:31:01 +02:00
Ignacio Vera 7e246e8d82
Fix double counting GeoTileGrid aggregation (#74353)
Fix issue when bounding box crosses the dateline and covers all longitude values.
2021-06-22 08:03:52 +02:00
Ignacio Vera 603be001a9
Set parsesArrayValue to true for Shape field mappers (#73940)
bring shape and point implementation close together.
2021-06-09 11:31:33 +02:00
Ignacio Vera 1ed587d102
Move orientation enum out of ShapeBuilder (#73824) 2021-06-09 07:58:17 +02:00
Ignacio Vera 6466ce752d
Separate parsing geo format from fields API geo formats (#73806)
This change removes the current GeometryFormat interface and replace then with a GeometryParser that deals 
with Parsing formats and a GeometryFormatFactory that deals with fields API formats.
2021-06-09 06:32:12 +02:00
Ryan Ernst 63012c8a40
Move ParseField to o.e.c.xcontent (#73923)
ParseField is part of the x-content lib, yet it doesn't exist under the
same root package as the rest of the lib. This commit moves the class to
the appropriate package.

relates #73784
2021-06-08 13:32:14 -07:00
Ryan Ernst 68817d7ca2
Rename o.e.common in libs/core to o.e.core (#73909)
When libs/core was created, several classes were moved from server's
o.e.common package, but they were not moved to a new package. Split
packages need to go away long term, so that Elasticsearch can even think
about modularization. This commit moves all the classes under o.e.common
in core to o.e.core.

relates #73784
2021-06-08 09:53:28 -07:00
Ignacio Vera d42c0cf016
Make methods in GeoJson and WellKnownText static (#73805)
This change makes all methods on those utility classes static.
2021-06-08 08:37:29 +02:00
Ignacio Vera 7f5ff7167c
GeoShapeIndexer#prepareForIndex should be called for computing the doc value centroid (#73856) 2021-06-08 06:14:23 +02:00
Ignacio Vera 094f193ee2
Remove ParsedPoint interface from point field mappers (#73710) 2021-06-04 17:24:02 +02:00
Ignacio Vera 409b6cefe3
Add painless script support for geo_shape field (#72886)
Users can access the centroid, bounding box and dimensional type of the shape.
2021-05-26 18:55:45 +02:00
Ignacio Vera 157f5336db
speed up geotile aggregation over geo_shape field (#72984)
compute the range of tiles that needs to be added instead of using recursion.
2021-05-26 07:16:17 +02:00
Ignacio Vera 310342fc2e
Fix test testGeoShapeBounds (#72878)
computing hashes for points is consistent between geo_shape and geo_point
2021-05-12 06:48:04 +02:00
Ignacio Vera 15da180b0c
mute GeoShapeGeoHashGridAggregatorTests#testGeoShapeBounds (#72873) 2021-05-10 09:53:48 +02:00
Ignacio Vera 5407824cda
Handle properly precision 0 for BoundedGeoTileGrid (#72800)
For GeoTileAggregation, the relationship between the grid and the bounded box
can be disjoint.
2021-05-10 07:56:21 +02:00
Rene Groeschke e609e07cfe
Remove internal build logic from public build tool plugins (#72470)
Extract usage of internal API from TestClustersPlugin and PluginBuildPlugin and related plugins and build logic

This includes a refactoring of ElasticsearchDistribution to handle types
better in a way we can differentiate between supported Elasticsearch
Distribution types supported in TestCkustersPlugin and types only supported
in internal plugins.

It also introduces a set of internal versions of public plugins.

As part of this we also generate the plugin descriptors now.

As a follow up on this we can actually move these public used classes into 
an extra project (declared as included build)

We keep LoggedExec and VersionProperties effectively public And workaround for RestTestBase
2021-05-06 14:02:35 +02:00
Ignacio Vera 893d4efc41
Do not over-allocate when resizing in GeoHashTiler with bounds (#72539) 2021-05-03 10:18:35 +02:00
Ignacio Vera 4fff3788f3
Disallow creating geo_shape mappings with deprecated parameters (#70850)
With the introduction of BKD-based geo shape indexing in #32039, the prefix tree indexing method has 
been deprecated. From 8.0.0, it will not be allowed to create new mappings using deprecated parameters.
2021-04-30 11:08:58 +02:00
Alan Woodward 009f23e7a9
Explicitly say if stored fields aren't supported in MapperTestCase (#72474)
MapperTestCase has a check that if a field mapper supports stored fields,
those stored fields are available to index time scripts. Many of our mappers
do not support stored fields, and we try and catch this with an assumeFalse
so that those mappers do not run this test. However, this test is fragile - it
does not work for mappers created with an index version below 8.0, and it
misses mappers that always store their values, e.g. match_only_text.

This commit adds a new supportsStoredField method to MapperTestCase,
and overrides it for those mappers that do not support storing values. It
also adds a minimalStoredMapping method that defaults to the minimal
mapping plus a store parameter, which is overridden by match_only_text
because storing is not configurable and always available on this mapper.
2021-04-30 08:59:56 +01:00
Ignacio Vera 17717a0f6b
mute testGeoHashBoundsExcludeTouchingTiles (#72522) 2021-04-30 09:05:14 +02:00
Ignacio Vera 65aa3e7478
Avoid numerical error for sub-atomic values in GeoGridAggregation (#72394)
This change avoid creating sub-atomic values for GeoGridAggregation bounds.
2021-04-29 07:09:56 +02:00
Ignacio Vera 903f6fc1e8
Grid aggregations with bounds should exclude touching tiles (#72295) 2021-04-28 08:19:44 +02:00
Alan Woodward e002aa809b
Make FieldNamesFieldMapper responsible for adding its own doc fields (#71929)
The FieldNamesFieldMapper is a metadata mapper defining a field that
can be used for exists queries if a mapper does not use doc values or
norms. Currently, data is added to it via a special method on FieldMapper
that pulls the metadata mapper from a mapping lookup, checks to see
if it is enabled, and then adds the relevant value to a lucene document.

This is one of only two places that pulls a metadata mapper from the
MappingLookup, and it would be nice to remove this method. This commit
refactors field name handling by instead storing the names of fields to
index in the fieldnames field in a set on the ParseContext, and then
building the field itself in FieldNamesFieldMapper.postParse(). This means
that all of the responsibility for enabling indexing, etc, is handled within
the metadata mapper itself.
2021-04-27 16:03:46 +01:00
Ignacio Vera 423c47ac56
Refactor GeoGridTiler classes (#72201)
This PR introduces the classes  AbstractGeoHashGridTiler and AbstractGeoTileGridTiler in order to 
simplify the current class hierarchy.
2021-04-27 08:21:37 +02:00
Alan Woodward 72f9c4c122
Add null-field checks to shape field mappers (#71999)
#71696 introduced a regression to the various shape field mappers,
where they would no longer handle null values. This commit fixes
that regression and adds a testNullValues method to MapperTestCase
to ensure that all field mappers correctly handle nulls.

Fixes #71874
2021-04-21 15:54:22 +01:00
Alan Woodward 630a43f9bd
Add deprecation warnings to geo fields that define multifields (#71912)
With the exception of geo_point, no geometry field mappers actually support
the use of multifields. However, we happily accept multifield definitions on these
mappers and silently ignore them when it comes to indexing documents. With
this commit, we emit deprecation warnings when a multifield definition is included
on a geometry field mapper that does not in fact support one.
2021-04-21 13:14:37 +01:00
Alan Woodward ee3510b766
Add index-time scripts to geo_point field mapper (#71861)
This commit adds the ability to define an index-time geo_point field
with a script parameter, allowing you to calculate points from other
values within the indexed document.
2021-04-20 10:24:25 +01:00
Alan Woodward 289d202cb2
Rework geo mappers to index value by value (#71696)
The various geo field mappers are organised in a hierarchy that shares
parsing and indexing code. This ends up over-complicating things,
particularly when we have some mappers that accept multiple values
and others that only accept singletons. It also leads to confusing
behaviour around ignore_malformed behaviour: geo fields will ignore
all values if a single one is badly formed, while all other field mappers
will only ignore the problem value and index the rest. Finally, this
structure makes adding index-time scripts to geo_point needlessly
complex.

This commit refactors the indexing logic of the hierarchy to move the
individual value indexing logic into the concrete implementations,
and aligns the ignore_malformed behaviour with that of other mappers.

It contains two breaking changes:

* The geo field mappers no longer check for external field values on the
  parse context. This added considerable complication to the refactored
  parse methods, and is unused anywhere in our codebase, but may
  impact plugin-based field mappers which expect to use geo fields
  as multifields
* The geo_point field mapper now passes geohashes to its multifields
  one-by-one, instead of formatting them into a comma-delimited
  string and passing them all at once. Completion multifields using
  this as an input should still behave as normal because by default
  they would split this combined geohash string on the commas in any
  case, but keyword subfields may look different.

Fixes #69601
2021-04-19 12:38:01 +01:00
Lyudmila Fokina 3b0b7941ae
Warn users if security is implicitly disabled (#70114)
* Warn users if security is implicitly disabled

Elasticsearch has security features implicitly disabled by default for
Basic and Trial licenses, unless explicitly set in the configuration
file.
This may be good for onboarding, but it also lead to unintended insecure
 clusters.
 This change introduces clear warnings when security features are
 implicitly disabled.
 - a warning header in each REST response if security is implicitly
 disabled;
 - a log message during cluster boot.
2021-04-13 18:33:41 +02:00
Joe Gallo 2a0ec50d47
Apply REST API compatibility testing for the :x-pack plugins (#71302) 2021-04-06 11:35:33 -04:00
Alan Woodward 1653f2fe91
Add script parameter to long and double field mappers (#69531)
This commit adds a script parameter to long and double fields that makes
it possible to calculate a value for these fields at index time. It uses the same
script context as the equivalent runtime fields, and allows for multiple index-time
scripted fields to cross-refer while still checking for indirection loops.
2021-03-31 11:14:11 +01:00
Ignacio Vera a35563aaaf
Fix infinite loop when polygonizing a circle with centre on the pole (#70875)
This PR prevents the algorithm to run on circles that contain a pole.
2021-03-29 07:36:29 +02:00
Mark Vieira 6339691fe3
Consolidate REST API specifications and publish under Apache 2.0 license (#70036) 2021-03-26 16:20:14 -07:00
Nik Everett 91c700bd99
Super randomized tests for fetch fields API (#70278)
We've had a few bugs in the fields API where is doesn't behave like we'd
expect. Typically this happens because it isn't obvious what we expct. So
we'll try and use randomized testing to ferret out what we want. This adds
a test for most field types that asserts that `fields` works similarly
to `docvalues_fields`. We expect this to be true for most fields.

It does so by forcing all subclasses of `MapperTestCase` to define a
method that makes random values. It declares a few other hooks that
subclasses can override to further randomize the test.

We skip the test for a few field types that don't have doc values:
* `annotated_text`
* `completion`
* `search_as_you_type`
* `text`
We should come up with some way to test these without doc values, even
if it isn't as nice. But that is a problem for another time, I think.

We skip the test for a few more types just because I wanted to cut this
PR in half so we could get to reviewing it earlier. We'll get to those
in a follow up change.

I've filed a few bugs for things that are inconsistent with
`docvalues_fields`. Typically that means that we have to limit the
random values that we generate to those that *do* round trip properly.
2021-03-24 14:16:27 -04:00