Commit graph

926 commits

Author SHA1 Message Date
James Rodewig
c7ca1d5941 [DOCS] Make <target> defs consistent 2020-06-30 15:53:32 -04:00
James Rodewig
3d77914db7
[DOCS] Add data streams to count API (#58771) 2020-06-30 15:01:37 -04:00
James Rodewig
a7aa3da3bf
[DOCS] Add data streams to multi search API docs (#58610)
Makes the existing multi search API docs aware of data streams.
2020-06-26 17:06:58 -04:00
markharwood
cdc1be144b
Field capabilities - make keyword a family of field types (#58315)
Introduces a new method on `MappedFieldType` to return a family type name which defaults to the field type.
Changes `wildcard` and `constant_keyword` field types to return `keyword` for field capabilities.

Relates to #53175
2020-06-24 11:37:16 +01:00
James Rodewig
f00c8abe20
[DOCS] Add data streams to search docs (#58278)
Changes:

* Adds additional examples to the `Search a data stream` section of
  `Use a data stream`
* Updates existing search docs to make them aware of data streams
2020-06-18 08:43:02 -04:00
Jim Ferenczi
90c9b95ca0
Allow index filtering in field capabilities API (#57276)
* Add index filtering in field capabilities API

This change allows to use an `index_filter` in the
field capabilities API. Indices are filtered from
the response if the provided query rewrites to `match_none`
on every shard:

````
GET metrics-*
{
  "index_filter": {
    "bool": {
      "must": [
        "range": {
          "@timestamp": {
            "gt": "2019"
          }
        }
      }
  }
}
````

The filtering is done on a best-effort basis, it uses the can match phase
to rewrite queries to `match_none` instead of fully executing the request.
The first shard that can match the filter is used to create the field
capabilities response for the entire index.

Closes #56195
2020-06-17 22:53:53 +02:00
James Rodewig
c0191eb84c
[DOCS] Fix routing param in search API docs (#58267) 2020-06-17 15:05:20 -04:00
Adam Locke
961a85e1e6
[DOCS] Add documentation for near real-time search (#57560)
* Adding documentation for near real-time search.

* Adding link to NRT topic and clarifying some text.

* Adding diagrams and incorporating changes from David T.
2020-06-15 14:49:33 -04:00
James Rodewig
7826bbee87
[DOCS] Move search API's docvalue_fields examples (#57760)
Changes:

* Condenses and relocates the `docvalue_fields` example to the 'Run a search' 
   page.
* Adds docs for the `docvalue_fields` request body parameter.
* Updates several related xrefs.

Co-authored-by: debadair <debadair@elastic.co>
2020-06-11 10:57:15 -04:00
James Rodewig
0d081de7ad
[DOCS] Fix source-related search API params (#57691)
Cleans up the reference documentation for the following
search API parameters:

* `_source` query parameter
* `_source_excludes` query parameter
* `_source_includes` query parameter
* `_source` request body parameter
* `hits._source` response property
2020-06-09 12:44:57 -04:00
James Rodewig
51e3d5ab63
[DOCS] Fix source filtering xrefs (#57720) 2020-06-05 08:46:26 -04:00
James Rodewig
7f201d7f4f
[DOCS] Move source filtering examples (#57689)
Moves the source filtering example snippets form the "Request body
search" API docs page to the "Return fields in a search" section of the
"Run a search" page.
2020-06-04 15:10:18 -04:00
James Rodewig
09980ca517
[DOCS] Reformat whitespace in search API docs (#57667)
Changes the search API docs to use:

* Consistent indentation in param definitions
* Two-space indentation in JSON snippets
2020-06-04 09:47:18 -04:00
Julie Tibshirani
de9b91fe48
Add a reference on returning fields during a search. (#57500)
This PR adds a section to the new 'run a search' reference that explains
the options for returning fields. Previously each option was only listed as a
separate request parameter and it was hard to know what was available.
2020-06-03 09:33:26 -07:00
James Rodewig
69b79d21fe
[DOCS] Add clear scroll API reference docs (#57367) 2020-06-03 11:42:43 -04:00
James Rodewig
3bb11cf269
[DOCS] Refactor admons for multi-parameter options (#57491)
Several APIs support options that can be specified as a query parameter or a
request body parameter.

Currently, this is documented using notes, which can get rather lengthy. This
replaces those multiple notes with a single note and a footnote.
2020-06-02 11:58:46 -04:00
James Rodewig
0496f9ab3b
[DOCS] Add scroll API reference docs (#57153)
Changes:

* Adds API reference docs for the scroll API
* Documents several related parameters in the search API docs
2020-06-02 09:33:11 -04:00
Julie Tibshirani
f46b04956b
Avoid unnecessary use of stored_fields in our docs. (#57488)
Generally we don't advocate for using `stored_fields`, and we're interested in
eventually removing the need for this parameter. So it's best to avoid using
stored fields in our docs examples when it's not actually necessary.

Individual changes:
* Avoid using 'stored_fields' in our docs.
* When defining script fields in top-hits, de-emphasize stored fields.
2020-06-01 17:29:48 -07:00
Lisa Cawley
8b9293b3bf
[DOCS] Replace docdir attribute with es-repo-dir (#57489) 2020-06-01 15:55:05 -07:00
Christoph Büscher
3d4f9fedaf
Check for negative "from" values in search request body (#54953)
Today we already disallow negative values for the "from" parameter in the search
API when it is set as a request parameter and setting it on the
SearchSourceBuilder, but it is still parsed without complaint from a search
body, leading to differing exceptions later. This PR changes this behavior to be
the same regardless of setting the value directly, as url parameter or in the
search body. While we silently accepted "-1" as meaning "unset" and used the
default value of 0 so far, any negative from-value is now disallowed.

Closes #54897
2020-05-28 16:25:19 +02:00
Nik Everett
9aaab6efdd
Save memory on numeric sig terms when not top (#56789)
This saves memory when running numeric significant terms which are not
at the top level by merging its collection into numeric terms and relying
on the optimization that we made in #55873.
2020-05-27 10:53:09 -04:00
James Rodewig
68ed00e2d2 [DOCS] Fix deep paging recommendations
Corrects recommendation to reference the `search_after` parameter,
not API.
2020-05-21 14:25:04 -04:00
Théophile Helleboid - chtitux
309d86df97
[DOCS] Fix typo in search API explain param def (#56991)
Co-authored-by: James Rodewig <james.rodewig@elastic.co>
2020-05-20 09:21:28 -04:00
James Rodewig
59fa4ccba3 [DOCS] Fix JS client attribute in docs
The Elasticsearch-JS client only produces documentation for major
versions (e.g., n.x, 7.x, 6.x).

However, the `{jsclient}` attribute uses the current `{branch}`, which
can result in broken links in minor version docs.

This swaps the `{jsclient}` attribute for `{jsclient-current}`,
which is less likely to break across versions.
2020-05-19 16:55:07 -04:00
Tomas Della Vedova
0e98652ed1
[DOCS] Add JS client helper links to docs (#55216)
Adds links for the Elasticsearch-js client to the bulk and scroll docs.
2020-05-19 16:17:24 -04:00
James Rodewig
56d7af09e7
[DOCS] Add search pagination docs (#56785)
Reworks the `from / size` content to `Paginate search results`.

Moves those docs from the request body search API page (slated for
deletion) to the `Run a search` tutorial docs.

Also adds some notes to the `from` and `size` param docs.

Co-authored-by: debadair <debadair@elastic.co>
2020-05-15 17:22:40 -04:00
James Rodewig
34dd9d1772 [DOCS] Correct typo in "Run a search" docs 2020-05-13 10:14:49 -04:00
Nik Everett
4a8d93f55b
Add list of defered aggregations to the profiler (#56208)
This adds a few things to the `breakdown` of the profiler:
* `histogram` aggregations now contain `total_buckets` which is the
  count of buckets that they collected. This could be useful when
  debugging a histogram inside of another bucketing agg that is fairly
  selective.
* All bucketing aggs that can delay their sub-aggregations will now add
  a list of delayed sub-aggregations. This is useful because we
  sometimes have fairly involved logic around which sub-aggregations get
  delayed and this will save you from having to guess.
* Aggregtations wrapped in the `MultiBucketAggregatorWrapper` can't
  accurately add anything to the breakdown. Instead they the wrapper
  adds a marker entry `"multi_bucket_aggregator_wrapper": true` so we
  can be quickly pick out such aggregations when debugging.

It also fixes a bug where `_count` breakdown entries were contributing
to the overall `time_in_nanos`. They didn't add a large amount of time
so it is unlikely that this caused a big problem, but I was there.

To support the arbitrary breakdown data this reworks the profiler so
that the `breakdown` can contain any data that is supported by
`StreamOutput#writeGenericValue(Object)` and
`XContentBuilder#value(Object)`.
2020-05-13 08:30:38 -04:00
James Rodewig
7c449319a1
[DOCS] Relocate shard allocation module content (#56535) 2020-05-12 08:55:57 -04:00
James Rodewig
c0e8c088fc
[DOCS] Relocate request body param docs to search API docs (#56436)
Moves documentation for the following request body parameters to the
search API reference docs:

* `explain`
* `query`
* `seq_no_primary_term`
* `version`

Removes documentation for these parameters from the Request body search
page[0].

[0]: https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html
2020-05-11 11:10:44 -04:00
James Rodewig
b5f219cc6f
[DOCS] Relocate search API's request body parameters (#56304)
Changes:
* Moves the document request body parameters for the search API
  from the Request body search page to the Search API reference page.

* Relocates a search request body example from the Request body search
  page to the Search API reference page.

* Adds a note to any duplicated query and request body parameters.
2020-05-07 09:50:22 -04:00
Luca Cavanna
6a69ab4a3e
[DOCS] Async search: clarify behaviour when submit returns final results (#55934)
* [DOCS] Async search: clarify behaviour when submit returns final results

Closes #55636

* reword

* iter
2020-05-06 10:00:30 +02:00
James Rodewig
7bcb4b78f7 [DOCS] Correct track_total_hits param default value 2020-05-05 10:50:01 -04:00
James Rodewig
759752e6f2 [DOCS] Correct track_total_hits param def formatting 2020-05-05 10:43:45 -04:00
James Rodewig
e6542c0823
[DOCS] Combine search API and URI search API reference docs (#55884)
The search API and URI search pages document the same `_search` API.
This combines the documentation from each page under the search API
docs.

Changes:

* Adds an abbreviated title for the search API page.
* Removes the following invalid query parameters:
  * `analyzer`
  * `analyze_wildcard`
  * `default_operator`
  * `df`
  * `lenient`
  * `suggest_mode`
  * `suggest_size`
* Removes the URI search docs page and adds a related redirect.
* Updates the headings of several examples

Co-authored-by: debadair <debadair@elastic.co>
2020-05-05 10:28:13 -04:00
James Rodewig
a73fef3d62
[DOCS] Create top-level "Search your data" page (#56058)
* [DOCS] Create top-level "Search your data" page

**Goal**

Create a top-level search section. This will let us clean up our search
API reference docs, particularly content from [`Request body search`][0].

**Changes**

* Creates a top-level `Search your data` page. This page is designed to
  house concept and tutorial docs related to search.

* Creates a `Run a search` page under `Search your data`. For now, This
  contains a basic search tutorial. The goal is to add content from
  [`Request body search`][0] to this in the future.

* Relocates `Long-running searches` and `Search across clusters` under
  `Search your data`. Increments several headings in that content.

* Reorders the top-level TOC to move `Search your data` higher. Also
  moves the `Query DSL`, `EQL`, and `SQL access` chapters immediately
  after.

Relates to #48194

[0]: https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html
2020-05-05 09:46:29 -04:00
James Rodewig
5572ccebae
[DOCS] Add collapsible sections to search API response (#55887) 2020-05-04 16:32:19 -04:00
Luca Cavanna
c04bf6e14a
[DOCS] Clarify async search response flags (#55574)
Relates to #55572
2020-04-29 15:21:26 +02:00
James Rodewig
26f1851ce0
[DOCS] Correct search API's timeout parm default (#55855) 2020-04-28 09:43:52 -04:00
Adrien Grand
b614412569
Repurpose ignore_throttled to be only about frozen indices. (#55047)
This has no practical impact on users since frozen indices are the only
throttled indices today. However this has an impact on upcoming features
that would use search throttling.

Filtering out throttled indices made sense a couple years ago, but as
we're now improving support for slow requests with `_async_search` and
exploring ways to reduce storage costs, this feature has most likely
become a trap, that we'd like to not have with upcoming features that
would use search throttling.

Relates #54058
2020-04-28 13:43:35 +02:00
James Rodewig
4980ea7596
[DOCS] Document max_concurrent_searches default (#55116) 2020-04-15 10:02:33 -04:00
Julie Tibshirani
13053c6ad9
Remove the object format for indices_boost. (#55078)
This format has been deprecated since version 5.2.
2020-04-14 21:01:07 -07:00
Christoph Büscher
7b199dbcec
[Test] Don't expect specific scores in docs tests (#54297)
The failing suggester documentation test was expecting specific scores in the
test response, which is fragile implementation details that e.g. can change with
different lucene versions and generally shouldn't be done in documentation test.
Instead we usually replace the float values in the output response by the ones
in the actual response.

Closes #54257
2020-03-27 10:23:16 +01:00
David Turner
10f19703e8
Mute test failing in #54257 (#54258) 2020-03-26 11:10:00 +00:00
Luca Cavanna
1c482141ee
Async search: rename REST parameters (#54198)
This commit renames wait_for_completion to wait_for_completion_timeout in submit async search and get async search.
Also it renames clean_on_completion to keep_on_completion and turns around its behaviour.

Closes #54069
2020-03-26 09:40:05 +01:00
Luca Cavanna
8c29035635
Async search: prevent users from overriding pre_filter_shard_size (#54088)
Submit async search forces pre_filter_shard_size for the underlying search that it creates.
With this commit we also prevent users from overriding such default as part of request validation.
2020-03-24 17:04:38 +01:00
Jim Ferenczi
04bd154037
Add heuristics to compute pre_filter_shard_size when unspecified (#53873)
This commit changes the pre_filter_shard_size default from 128 to unspecified.
This allows to apply heuristics based on the request and the target indices when deciding
whether the can match phase should run or not. When unspecified, this pr runs the can match phase
automatically if one of these conditions is met:
  * The request targets more than 128 shards.
  * The request contains read-only indices.
  * The primary sort of the query targets an indexed field.
Users can opt-out from this behavior by setting the `pre_filter_shard_size` to a static value.

Closes #39835
2020-03-23 19:06:32 +01:00
Luca Cavanna
aa56f91fba
[DOCS] address timing issue in async search docs tests (#53910)
The docs snippets for submit async search have proven difficult to test as it is not possible to guarantee that you get a response that is not final, even when providing `wait_for_completion=0`. In the docs we want to show though a proper long-running query, and its first response should be partial rather than final.

With this commit we adapt the docs snippets to show a partial response, and replace under the hood all that's needed to make the snippets tests succeed when we get a final response. Also, increased the timeout so we always get a final response.

Closes #53887
Closes #53891
2020-03-23 14:17:53 +01:00
Luca Cavanna
1af04175a1
Async search: remove version from response (#53960)
The goal of the version field was to quickly show when you can expect to find something new in the search response, compared to when nothing has changed. This can also be done by looking at the `_shards` section and `num_reduce_phases` returned with the search response. In fact when there has been one or more additional reduction of the results, you can expect new results in the search response. Otherwise, the `_shards` section could notify of additional failures of shards that have completed the query, but that is not a guarantee that their results will be exposed (only when the following partial reduction is performed their results will be available).

That said this commit clarifies this in the docs and removes the version field from the async search response
2020-03-23 13:42:10 +01:00
Mark Vieira
3cf3f60f93
Mute submit-async-search-date-histogram-example test 2020-03-20 11:19:03 -07:00