Commit Graph

2413 Commits

Author SHA1 Message Date
Nik Everett 4b5aebe8b0
Add setting to disable aggs optimization (#73620)
Sometimes our fancy "run this agg as a Query" optimizations end up
slower than running the aggregation in the old way. We know that and use
heuristics to dissable the optimization in that case. But it turns out
that the process of running the heuristics itself can be slow, depending
on the query. Worse, changing the heuristics requires an upgrade, which
means waiting. If the heurisics make a terrible choice folks need a
quick way out. This adds such a way: a cluster level setting that
contains a list of queries that are considered "too expensive" to try
and optimize. If the top level query contains any of those queries we'll
disable the "run as Query" optimization.

The default for this settings is wildcard and term-in-set queries, which
is fairly conservative. There are certainly wildcard and term-in-set
queries that the optimization works well with, but there are other queries
of that type that it works very badly with. So we're being careful.

Better, you can modify this setting in a running cluster to disable the
optimization if we find a new type of query that doesn't work well.

Closes #73426
2021-06-02 09:12:54 -04:00
Rene Groeschke b2a183baf0
Move public build api into included build (#72861)
This moves the public build api and plugins into a separete included build called 'build-tools' 
and we removed the duplication of included buildSrc twice (2nd import as build-tools).

The elasticsearch internal build logic is kept in build-tools-internal as included build which allows us better handling of this project that its just being an buildSrc project (e.g. we can reference tasks directly from the root build etc.)

Convention logic applied to both projects will live in a new build-conventions project.
2021-06-01 11:19:30 +02:00
Yang Wang da3d72c724
Add docs and rest api spec for saml complete logout API (#72867)
This PR adds the documentation and Rest API spec file for the SAML complete
logout API. It is a (overdued) follow up for #56316
2021-05-31 11:28:16 +10:00
Julie Tibshirani 67680dbc49 Unmute field collapsing and search_after REST test 2021-05-26 17:16:34 -07:00
David Turner 221c571761
Fix location of repository analyzer API spec (#73378)
The repository analyzer API spec was incorrectly stored in the plugin
directory rather than in the main `rest-api-spec` directory. This commit
fixes that.
2021-05-25 20:23:12 +01:00
David Roberts 6050bd55a4
Muting search/110_field_collapsing/field collapsing and search_after (#73320)
Due to https://github.com/elastic/elasticsearch/issues/73316
2021-05-24 13:21:03 +01:00
Julie Tibshirani b23dfe29d5 Adjust REST tests now that #73023 is backported 2021-05-19 16:24:23 -07:00
Julie Tibshirani f85a9dddb9
Support field collapsing with search_after (#73023)
This change adds support for using `search_after` with field collapsing. When
using these in conjunction, the same field must be used for both sorting and
field collapsing. This helps keep the behavior simple and predictable.
Otherwise it would be possible for a group to appear on multiple pages of
results.

Currently search after is handled directly in `CollapsingTopDocsCollector`. As
a follow-up, we could generalize the logic and move support to the Lucene
grouping framework.

Closes #53115.
2021-05-19 14:21:18 -07:00
István Zoltán Szabó a6830edac8
Fixes URL in security enroll node API json. (#73228) 2021-05-19 14:34:11 +02:00
Przemyslaw Gomulka 35460a5f8a
[Rest Api Compatibility] REST Terms vector typed response (#73117)
Enabling the tests and adds a type field for termvector response
the commit that enabled typed endpoints but missed to update the response
#72155
2021-05-19 13:23:47 +02:00
Przemyslaw Gomulka d5bf72ab13
[Rest Api Compatibility] Typed endpoints for RestUpdateAction and RestDeleteAction (#73115)
the previously removed typed enpotins for Update and Delete are
retrofitted in this commit
the commit that removed them
https://github.com/elastic/elasticsearch/pull/47671

relates main meta issue #51816
relates types removal issue #54160
2021-05-18 13:07:13 +02:00
Seth Michael Larson ff406a88cc
Rename 'termsenum' API to 'terms_enum' for better readability 2021-05-17 08:08:06 -05:00
Przemyslaw Gomulka 85ed9100df
[Rest Api Compatibility] Typed endpoints for search and related endpoints (#72155)
Implements a V7 compatible typed endpoints for REST for search related apis
retrofits the REST layer change removed in #41640

relates main meta issue #51816
relates types removal issue #54160
2021-05-12 21:00:19 +02:00
James Rodewig 7909d3bd77
[DOCS] Fix JSON spec link for terms enum API (#72996) 2021-05-12 12:57:56 -04:00
Ioannis Kakavas b826703e21
Enroll node API (#72129)
Enroll node API can be used by new nodes in order to join an
existing cluster that has security features enabled. The response
of a call to this API contains all the necessary information that
the new node requires in order to configure itself and bootstrap
trust with the existing cluster.
2021-05-12 08:45:02 +03:00
Nik Everett db80a50b74
Update skip after backport (#72921)
Now that #72727 has landed in 7.x we can run the bwc tests against its
changes.
2021-05-11 09:12:51 -04:00
Nik Everett a43b166d11
More debugging info for significant_text (#72727)
Adds some extra debugging information to make it clear that you are
running `significant_text`. Also adds some using timing information
around the `_source` fetch and the `terms` accumulation. This lets you
calculate a third useful timing number: the analysis time. It is
`collect_ns - fetch_ns - accumulation_ns`.

This also adds a half dozen extra REST tests to get a *fairly*
comprehensive set of the operations this supports. It doesn't cover all
of the significance heuristic parsing, but its certainly much better
than what we had.
2021-05-10 12:50:46 -04:00
Przemyslaw Gomulka 668a72dec5
[Rest API Compatibility] Typed endpoints for Put and Get Mapping and get field mappings (#71721)
Implements a V7 compatible typed endpoints for REST put and get mapping endpoints. Also for Get Field Mappings endpoints.
retrofits the REST layer change removed in #41676

relates main meta issue #51816
relates types removal issue #54160
2021-05-10 10:25:48 +02:00
markharwood 73e0662f09
New TermsEnum API for discovering terms in the index. (#66452)
New api designed for use by apps like Kibana for auto-complete use cases.
A search string is supplied which is used as prefix for matching terms found in a given field in the index.
Supported field types are keyword, constant_keyword and flattened.
A timeout can limit the amount of time spent looking for matches (default 1s) and an `index_filter` query can limit indices e.g. those in the hot or warm tier by querying the `_tier` field

Closes #59137
2021-05-06 10:45:37 +01:00
Przemyslaw Gomulka e0799c82d8
[Rest Api Compatibility] transformations for keys in match and length (#72156) 2021-05-04 09:56:37 -04:00
Joe Gallo 3fd49d81b7
Adjust yamlRestCompatTest to account for some tests that are passing (#72437) 2021-04-29 09:38:22 -04:00
Christos Soulios 99e2cf08a0
Add REST tests for histogram aggregation (#72322)
Related to #26220
2021-04-28 17:54:43 +03:00
Nik Everett b31dba558d
Update skip after backport (#72381)
Now that #72081 has landed in the 7.x branch we can run its test in the
backwards compatibility test suite.
2021-04-28 09:15:06 -04:00
Nik Everett 5f281ceedd
Prevent `date_histogram` from OOMing (#72081)
This prevents the `date_histogram` from running out of memory allocating
empty buckets when you set the interval to something tiny like `seconds`
and aggregate over a very wide date range. Without this change we'd
allocate memory very quickly and throw and out of memory error, taking
down the node. With it we instead throw the standard "too many buckets"
error.

Relates to #71758
2021-04-27 14:41:52 -04:00
Julie Tibshirani fdf254335f
Remove more references to query_and_fetch. (#71988)
This search type was deleted several releases ago.
2021-04-23 09:19:57 -07:00
Christoph Büscher a84a237f05
Fix fetch_fields yaml test result order (#71691)
The test failing in #71685 does so because under rare circumstance the result
order for match_all can be different. If we want to make assertions on specific
entries in the result, we should sort by a field that imposes a fixed result
ordering.

Closes #71685
2021-04-23 10:30:33 +02:00
Nik Everett 39fee5e908
Fix composite early termination on sorted (#72101)
I broke composite early termination when reworking how aggregations'
contact for `getLeafCollector` around early termination in #70320. We
didn't see it in our tests because we weren't properly emulating the
aggregation collection stage. This fixes early termination by adhering
to the new contract and adds more tests.

Closes #72078

Co-authored-by: Benjamin Trent <4357155+benwtrent@users.noreply.github.com>
2021-04-22 14:32:26 -04:00
Mark Tozzi 05a68e0b57
Fix skip version on composite filter now that it's backported (#71878) 2021-04-22 11:41:22 -04:00
Nik Everett f88fd37df4
Update skip after backport of #71758 (#72047)
Now that #71758 has landed in 7.x we don't have to skip its tests when
running backwards compatibility tests.
2021-04-21 17:51:15 -04:00
Tomas Della Vedova b4739e153e
Fix monitoring.bulk spec content_type (#71629) 2021-04-21 09:03:25 -04:00
Yang Wang 150b6ad37a
Service Accounts - add rest specs and tests (#71888)
This PR adds rest specs and associated tests for APIs of the service accounts feature.
2021-04-21 14:29:14 +10:00
Nik Everett cf8d56a6e5
Prevent histogram from allocating tons of buckets (#71758)
This prevents the `histogram` aggregation from allocating tons of empty
buckets when you set the `interval` to something tiny. Instead, we
reject the request. We're not in a place where we can aggregate over
huge ranges with tiny intervals, but we should fail gracefully when you
ask us to do so rather than OOM.

Closes #71744
2021-04-20 18:10:59 -04:00
Tim Brooks bfb85bcecb
Wait on index when polling global checkpoints (#71890)
Currently when the fleet global checkpoints API returns immediately if
the index is not ready or shards are not ready. This commit modifies the
API to wait on the index and primary shards active up until the timeout
period.

Related to #71449.
2021-04-20 13:04:42 -06:00
Tanguy Leroux f50b35719e
Revive documentation for experimental Searchable Snapshots APIs (#71927)
This commit revives the documentation of the "Clear Cache" and 
"Shard Stats" APIs of Searchable Snapshots that was removed 
in #62217. This is a partial revert of the commit b545c55 with 
some light wording changes.

Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
2021-04-20 18:34:48 +02:00
David Turner 83c64ded2d
Adjust BWC for tracking snapshot index details (#71913)
Re-enables BWC tests and completes the backport of #71754
2021-04-20 13:16:14 +01:00
Mark Tozzi 7b29cb31b4
Allow composite to be a sub-aggregation of filter (#71639) 2021-04-19 13:28:03 -04:00
Tanguy Leroux ceaa16eddc
Add node level cache stats for searchable snapshots (#71701)
This commit adds node-level statistics about the searchable 
snapshots shared cache that can be retrieved using the REST 
endpoint `GET /_searchable_snapshots/cache/stats`.

And the returned informations are:
{
  "nodes" : {
    "eerrtBMtQEisohZzxBLUSw" : {
      "shared_cache" : {
        "reads" : 6051,
        "bytes_read" : "5.1mb",
        "bytes_read_in_bytes" : 5448829,
        "writes" : 37,
        "bytes_written" : "1.1mb",
        "bytes_written_in_bytes" : 1208320,
        "evictions" : 5,
        "num_regions" : 32,
        "size" : "1mb",
        "size_in_bytes" : 1048576,
        "region_size" : "32kb",
        "region_size_in_bytes" : 32768
      }
    }
  }
}
2021-04-19 17:02:27 +02:00
David Turner c8fb9aad40
Track index details in SnapshotInfo (#71754)
This commit adds some per-index statistics to the `SnapshotInfo` blob:

- number of shards
- total size in bytes
- maximum number of segments per shard

It also exposes these statistics in the get snapshot API.
2021-04-19 14:57:32 +01:00
Dimitris Athanasiou b5a8ffd7ca
[ML] Mark data frame analytics API specs as GA (#71818) 2021-04-19 16:29:08 +03:00
Przemyslaw Gomulka 3ef5e4c6e7
[Rest Compatible Api] include_type_name parameter (#70966)
This commit allows to use the include_type_name parameter with the compatible rest api.
The support for include_type_name was previously removed in #48632

relates #51816
types removal meta issue #54160
2021-04-19 15:21:24 +02:00
Rick Boyd 53b0141a11
Fix cluster.get_settings documentation URL 2021-04-16 10:56:12 -05:00
Igor Motov 02eef40a45
Tests: add support for close_to assertion (#71590)
Adds support for close_to assertion to yaml tests. The assertion can be called
the following way:
```
  - close_to:   { get.fields._routing: { value: 5.1, error: 0.00001 } }
```
Closes #71303
2021-04-15 17:11:37 -10:00
Christoph Büscher 5e481b4b36 [Test] Adapt skip version after backport 2021-04-15 15:51:50 +02:00
Christoph Büscher 708947b4bd Skip flattend subfields rest test 2021-04-15 14:57:39 +02:00
Tanguy Leroux d1c3b71384
Reenable BWC tests after backport of #71725 (#71732)
This commit reenables BWC tests (disabled in #71728) and adjusts some versions.
2021-04-15 13:38:40 +02:00
Christoph Büscher 948d02e4d6
Support fetching flattened subfields (#70916)
Currently the `fields` API fetches the root flattened field and returns it in a
structured way in the response. In addition this change makes it possible to
directly query subfields. However, requesting flattened subfields via wildcard
patterns is not possible.

Closes #70605
2021-04-15 12:28:58 +02:00
Tanguy Leroux fe4c3e745c
Enhanced segment files sizes information in Nodes Stats/Indices Stats APIs (#71643)
Since #16661 it is possible to know the total sizes for some Lucene segment files 
by using the Node Stats or Indices Stats API with the include_segment_file_sizes 
parameter, and the list of file extensions has been extended in #71416.

This commit adds a bit more information about file sizes like the number of files 
(count), the min, max and average file sizes in bytes that share the same extension.

Here is a sample:
"cfs" : {
  "description" : "Compound Files",
  "size_in_bytes" : 2260,
  "min_size_in_bytes" : 2260,
  "max_size_in_bytes" : 2260,
  "average_size_in_bytes" : 2260,
  "count" : 1
}

This commit also simplifies how compound file sizes were computed: before 
compound segment files were extracted and sizes aggregated with regular 
non-compound files sizes (which can be confusing and out of the scope of 
the original issue #6728), now CFS/CFE files appears as distinct files.

These new information are provided to give a better view of the segment 
files and are useful in many cases, specially with frozen searchable snapshots 
whose segment stats can now be introspected thanks to the 
include_unloaded_segments parameter.
2021-04-15 10:15:26 +02:00
Julie Tibshirani 2318be0be2 Adjust skip versions for combined_fields tests.
We can run the REST tests against 7.13 now that it's been backported.
2021-04-14 16:06:20 -07:00
Nik Everett 2d6f8d1e0c
Add integration tests for filters (#69439)
Revamps the integration tests for the `filter` agg to be more clear and
builds integration tests for the `fitlers` agg. Both of these
integration tests are fairly basic but they do assert that the aggs
work.
2021-04-14 16:54:23 -04:00
Julie Tibshirani 318bf14126
Introduce `combined_fields` query (#71213)
This PR introduces a new query called `combined_fields` for searching multiple
text fields. It takes a term-centric view, first analyzing the query string
into individual terms, then searching for each term any of the fields as though
they were one combined field. It is based on Lucene's `CombinedFieldQuery`,
which takes a principled approach to scoring based on the BM25F formula.

This query provides an alternative to the `cross_fields` `multi_match` mode. It
has simpler behavior and a more robust approach to scoring.

Addresses #41106.
2021-04-14 13:33:19 -07:00