Commit graph

1020 commits

Author SHA1 Message Date
Nik Everett
9950afbabe
Fit runtime field on line (backport #71470) (#71600)
This shrinks a runtime field definition so that it fits on the screen
without scrolling. It also converts the doc into a test so we can be
sure it continues to work.

Relates to #69291
2021-04-13 08:59:27 -04:00
James Rodewig
9ec05e7f4f [DOCS] Fix search template label 2021-04-08 13:14:29 -04:00
Nik Everett
121ecb959d
Convert metric aggs docs runtime fields (backport of #71260) (#71298)
This replaces the `script` docs for bucket aggregations with runtime
fields. We expect runtime fields to be nicer to work with because you
can also fetch them or filter on them. We expect them to be faster
because their don't need this sort of `instanceof` tree:
a92a647b9f/server/src/main/java/org/elasticsearch/search/aggregations/support/values/ScriptDoubleValues.java (L42)

Relates to #69291

Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-04-05 13:24:19 -04:00
Julie Tibshirani
66a85c6c04 Remove the beta flag from 'fields' option. (#71130)
Now that we've addressed the open issues, the 'fields' option can be considered GA.

Relates to #60985.
2021-03-31 10:05:56 -07:00
James Rodewig
c757f9e4e7
[DOCS] Fix double spaces (#71082) (#71120) 2021-03-31 11:43:34 -04:00
Jim Ferenczi
0994a894a7
Expose if a field is a metadata field in the field capabilities response (#71047)
This change exposes for each field in the _field_caps response if the field is a metadata field.
This is needed for consumers of this API that want to filter these fields. Currently ML keeps a static list
and QL checks that the family type starts with `_`. In order to ease the addition of new metadata fields, this
change reworks the strategy in this solution and now only checks for the new flag.
Note that the new flag is also applied at the coordinator level in a best-effort to apply the logic on older nodes
in a mixed-version cluster.
2021-03-30 15:39:23 +02:00
Nhat Nguyen
3d6b9857c4
Move point in time to server (#70704) (#70952)
This change moves the implementation of point in time to the server package.
2021-03-28 16:58:35 -04:00
Adam Locke
31fea35300
[DOCS] Clarify language for supported APIs with CCS and older clusters (#70734) (#70881)
* [DOCS] Clarify supported features for CCS.

* Clarify text and add subsection with title.

* Moving APIs to supported API section and paring down text.
2021-03-25 14:08:08 -04:00
Nhat Nguyen
8d3ca4e755
Allow format sort values of date fields (#70357)
If a search after request targets multiple indices and some of its sort
field has type `date` in one index but `date_nanos` in other indices,
then Elasticsearch won't interpret the search_after parameter correctly
in every target index. The sort value of a date field by default is a
long of milliseconds since the epoch while a date_nanos field is a long
of nanoseconds.

This commit introduces the `format` parameter in the sort field so a
sort value of a date or date_nanos will be formatted using a date format
in a search response.

The below example illustrates how to use this new parameter.

```js
{
    "query": {
        "match_all": {}
    },
    "sort": [
        {
            "timestamp": {
                "order": "asc",
                "format": "strict_date_optional_time_nanos"
           }
        }
    ]
}
```

```js
{
    "query": {
        "match_all": {}
    },
    "sort": [
        {
            "timestamp": {
                "order": "asc",
                "format": "strict_date_optional_time_nanos"
            }
        }
    ],
    "search_after": [
        "2015-01-01T12:10:30.123456789Z" // in `strict_date_optional_time_nanos` format
    ]
}
```

Closes #69192
2021-03-21 11:28:45 -04:00
István Zoltán Szabó
9c3d540570
[DOCS] Fixes typo in async search API docs. (#70448) (#70457) 2021-03-17 10:50:00 +01:00
Yang Wang
5623706e2c
Improve user check for resource sharing and its documentation (#69844) (#70216)
The user check when accessing shared resources is improved to be more accurate. 
Also add documentation about how it works and its limitations.
2021-03-10 23:35:21 +11:00
James Rodewig
ec26084561
[DOCS] Document PIT security for aliases (#69572) (#69967) 2021-03-04 09:37:08 -05:00
James Rodewig
0a83c20add
[DOCS] Add xref for runtime fields (#69738) (#69747) 2021-03-01 16:35:56 -05:00
James Rodewig
b6cfc23360
[DOCS] Add fields parameter to EQL search API (#69634) (#69726) 2021-03-01 12:15:19 -05:00
James Rodewig
4d43d3f881
[DOCS] Remove performance warning for script fields (#69309) (#69354) 2021-02-22 10:20:33 -05:00
James Rodewig
7f7dc9dec3
[DOCS] Fix capitalization for Query DSL (#69236) (#69240) 2021-02-18 19:40:36 -05:00
Jim Ferenczi
3fa3627066 Add automatic tiebreaker for search requests that use a PIT (#68833)
This PR adds the special `_shard_doc` sort tiebreaker automatically to any
search requests that use a PIT. Adding the tiebreaker ensures that any
sorted query can be paginated consistently within a PIT.

Closes #56828
2021-02-18 10:32:16 +01:00
James Rodewig
b55249507e
[DOCS] Fix typos for duplicate words (#69125) (#69132) 2021-02-17 11:16:58 -05:00
Jim Ferenczi
7c968918c2
Add a cluster privilege to cancel tasks and delete async searches (#68679) (#69023)
This change adds a new cluster privilege cancel_task that allows to:

Cancel running tasks (_tasks/_cancel).
Cancel and delete async searches.
Today the 'manage' cluster privilege is required to cancel tasks and
to delete async searches when security features are enabled.
This new focused privilege allows to handle tasks and searches only.

The change also adds the privilege to the internal 'kibana_system'
and '_async_search' roles. They both need to be able to cancel tasks
and delete async searches.

Relates #67965
2021-02-16 12:49:29 +01:00
Marios Trivyzas
931e149bbb
Add query param to limit highlighting to specified length (#67325) (#69016)
Add a `max_analyzed_offset` query parameter to allow users
to limit the highlighting of text fields to a value less than or equal to the
`index.highlight.max_analyzed_offset`, thus avoiding an exception when
the length of the text field exceeds the limit. The highlighting still takes place,
but stops at the length defined by the new parameter.

Closes: #52155
(cherry picked from commit f9af60bf69)
2021-02-16 12:32:24 +01:00
Igor Motov
1dcdda862e
[7.x] Revert "Remove aggregation's postCollect phase (#68942)
This partially reverts #64016 and and adds #67839 and adds
additional tests that would have caught issues with the changes
in #64016. It's mostly Nik's code, I am just cleaning things up
a bit.

Co-authored-by: Nik Everett nik9000@gmail.com
2021-02-11 20:46:53 -05:00
Christoph Büscher
96e3428d56
Add runtime field section to Field Capabilities API (#68904) (#68915)
Currently runtime fields from search requests don't appear in the output of the
field capabilities API, but some consumer of runtime fields would like to see
runtime section just like they are defined in search requests reflected and
merged into the field capabilities output.
This change adds parsing of a "runtime_mappings" section equivallent to the one
on search requests to the `_field_caps` endpoint, passes this section down to
the shard level where any runtime fields defined here overwrite the mapping of
the targetet indices.

Closes #68117
2021-02-11 17:41:46 +01:00
Christoph Büscher
64f2f6af05 [Docs] Add nested fields handling in fields API (#68657)
This change adds a paragraph on the different response format for nested fields
in the fields API and adds an example snippet.

Related to #63709
2021-02-09 18:37:13 +01:00
James Rodewig
925c8437b8
[DOCS] Add collapsible sections to multi search API docs (#68695) (#68706)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-02-08 13:59:51 -05:00
James Rodewig
eef4358333
[DOCS] Fix caps for search template API docs (#68696) (#68703) 2021-02-08 13:59:06 -05:00
James Rodewig
58fdadfb0f
[DOCS] Format the multi search api doc (#68621) (#68691)
Co-authored-by: bellengao <gbl_long@163.com>
2021-02-08 12:50:45 -05:00
James Rodewig
93506123dd
[DOCS] Add security privileges to search API docs (#68009) (#68492) 2021-02-03 16:53:19 -05:00
Adam Locke
6d30b9ce06
[DOCS] Add links to ESS for setting up remote clusters on cloud. (#68401) (#68418) 2021-02-02 17:52:30 -05:00
James Rodewig
ca966065fb
[DOCS] Fix typo (#68364) (#68387)
Co-authored-by: Philippus Baalman <philippus@gmail.com>
2021-02-02 11:08:33 -05:00
James Rodewig
eb97df6039
[DOCS] Fix minor suggester doc errors (#68244) (#68303) 2021-02-01 09:48:41 -05:00
James Rodewig
ae87baf0a8
[DOCS] Fix title abbrevs for API docs (#68118) (#68120) 2021-01-28 11:27:23 -05:00
James Rodewig
8720087a95
[DOCS] Fix explain API anchors (#68007) (#68010) 2021-01-26 12:23:13 -05:00
Adam Locke
3185363400
[DOCS] Add beta admonition for runtime fields. (#67847) (#67849)
* Add beta admonition for runtime fields.

* Add beta admonition to search your data page.
2021-01-21 18:03:45 -05:00
Adam Locke
95e3810d15
[DOCS] [7.x] Updates to the runtime fields docs for 7.11+ (#67484) (#67711)
* [DOCS] [7.x] Updates to the runtime fields docs for 7.11+ (#67484)

* Moving examples to the page for retrieving runtime fields.

* Adding runtime_mappings to request body of search API.

* Updating runtime_mappings properties and adding runtime fields to search your data.

* Updating examples and hopefully fixing build failure.

* Fixing snippet formatting that was causing test failure.

* Adding page in Painless guide for runtime fields.

* Fixing typo.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* Fixing testresponse to include _type.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-01-19 12:50:19 -05:00
Nhat Nguyen
806b6eb474
Retry point in time on other copy when possible (#66713)
Relates #61062
2021-01-10 21:57:11 -05:00
James Rodewig
890271af11
[DOCS] Rewrite agg breakdown docs for profile API (#67042) (#67055) 2021-01-05 17:24:34 -05:00
James Rodewig
8c7e37f258
[DOCS] Fix typo (#66721) (#66741)
Co-authored-by: Alan Tan <taalantan@gmail.com>
2020-12-22 09:16:13 -05:00
Simon
6db44c1971 [Docs] Add option to reference stored templates for _rank_eval requests
The option to use templates already defined in the cluster is not explicitly stated in the docs.
This PR adds and example to the `rank_eval` documentation.
2020-12-10 15:13:29 +01:00
Adam Locke
68539f95a5
[DOCS] [7.x] Add docs for runtime fields (#62653) (#66140)
* [DOCS] Add docs for runtime fields (#62653)

* First steps in docs for runtime fields.

* Adding new page for runtime fields.

* Adding page for runtime fields.

* Adding more to the runtime fields topic.

* Adding parameters and retrieval options for runtime fields.

* Adding TESTSETUP for index creation.

* Incorporating review feedback.

* Incorporating reviewer feedback.

* Adding examples for runtime fields.

* Adding more context and simplifying the example.

* Changing timestamp to @timestamp throughout.

* Removing duplicate @timestamp field.

* Expanding example to hopefully fix CI builds.

* Adding skip test for result.

* Adding missing callout.

* Adding TESTRESPONSEs, which are currently broken.

* Fixing TESTRESPONSEs.

* Incorporating review feedback.

* Several clarifications, better test cases, and other changes.

* Adding missing callout in example.

* Adding substitutions to TESTRESPONSE for shorter results shown.

* Shuffling some information and adding link to script-fields.

* Fixing typo.

* Updates for API redesign -- will break builds.

* Updating examples and including info about overriding fields.

* Updating examples.

* Adding info for using runtime fields in the search request.

* Adding that queries against runtime fields are expensive.

* Incorporating feedback from reviewers.

* Minor changes from reviews.

* Adding alias for test case.

* Adding aliases to PUT example.

* Fixing test cases, for real this time.

* Updating use cases and introducing overlay throughout.

* Edits, adding 'shadowing', and explaining shadowing better.

* Streamlining tests and other changes.

* Fix formatting in example for test.

* Apply suggestions from code review

* Incorporating reviewer feedback 7 Dec

* Shifting structure of mapping page to fix cross links.

* Revisions for shadowing, overview, and other sections.

* Removing dot notation section and incorporating review changes.

* Adding updated example for shadowing.

* Streamlining shadowing example and TESTRESPONSEs.

* Adding type field in responses for 7.x to fix test cases.
2020-12-09 19:32:15 -05:00
Christoph Büscher
d20b754dd8
Support unmapped fields in search 'fields' option (#65386) (#65705)
Currently, the 'fields' option only supports fetching mapped fields. Since
'fields' is meant to be the central place to retrieve document content, it
should allow for loading unmapped values. This change adds implementation and
tests for this feature.

Closes #63690
2020-12-03 15:54:42 +01:00
James Rodewig
5a869b1001
[DOCS] Fix formatting issue in search explain docs (#65303) (#65312)
Co-authored-by: bellengao <gbl_long@163.com>
2020-11-20 09:21:21 -05:00
James Rodewig
2da6ccb3ea
[DOCS] Fix indentation (#64941) (#64963)
Co-authored-by: kemalizing <36174398+kemalizing@users.noreply.github.com>
2020-11-12 08:47:35 -05:00
James Rodewig
af84235c08
[DOCS] Fix typo (#64675) (#64801)
Co-authored-by: Ashish Jayan <58534490+chasexd@users.noreply.github.com>
2020-11-09 11:13:00 -05:00
Mayya Sharipova
ee080691d4
Async search status (#64554)
Introduce async search status API

GET /_async_search/status/<id>

The API is restricted to the monitoring_user role.

For a running async search, the response is:

```js
{
  "id" : <id>,
  "is_running" : true,
  "is_partial" : true,
  "start_time_in_millis" : 1583945890986,
  "expiration_time_in_millis" : 1584377890986,
  "_shards" : {
      "total" : 562,
      "successful" : 188,
      "skipped" : 0,
      "failed" : 0
  }
}
```

For a completed async search, an additional
`completion_status` fields is added.

```js
{
  "id" : <id>,
  "is_running" : false,
  "is_partial" : false,
  "start_time_in_millis" : 1583945890986,
  "expiration_time_in_millis" : 1584377890986,
  "_shards" : {
      "total" : 562,
      "successful" : 562,
      "skipped" : 0,
      "failed" : 0
  },
 "completion_status" : 200
}
```

Closes #57537
Backport for #62947
2020-11-03 16:39:45 -05:00
James Rodewig
5b1700b660
[DOCS] Rewrite aggs overview (#64318) (#64409)
- Replaces more abstract docs about object structure and values source with task-based examples.
- Relocates several sections from the current `misc.asciidoc` file.
- Alphabetically sorts agg categories in the nav.
- Removes the matrix agg family. Moves the stats matrix agg under the metric agg family

Co-authored-by: debadair <debadair@elastic.co>
2020-10-30 09:29:26 -04:00
James Rodewig
aea83909d9
[DOCS] Fix case for 'Boolean' (#64299) (#64341) 2020-10-29 10:04:20 -04:00
Nik Everett
be7021fcdc
Remove aggregation's postCollect phase (backport of #64016) (#64317)
After #63811 it became clear to me that `postCollect` is kind of
dangerous and not all that useful. So this removes it.

The trouble with `postCollect` is that it all happened right after we
finished calling `collect` on the `LeafBucketCollectors` but before we
built the aggregation results. But in #63811 we found out that we can't
call `postCollect` on the children of `parent` or `child` aggregators
until we know which *which* aggregation results we're building.

So this removes `postCollect` and moves all of the things we did at
post-collect phase into `buildAggregations` or into hooks called in
those methods.
2020-10-29 09:48:01 -04:00
Julie Tibshirani
76e5c371d6 Mark the search 'fields' option as beta. (#63699)
We've identified two important enhancements that may affect the API. We expect
any API changes from these enhancements to be minor, but want to leave open the
possibility for small breaks. For example, we may end up returning unmapped
fields by default, or omitting nested fields from the root hit. The impact to
users should be quite small.

We're tracking the issues we need to resolve before removing the 'beta' label
here: #60985.
2020-10-18 13:41:49 -07:00
James Rodewig
563dda4535
[DOCS] Fix typo in search profile docs (#63522) (#63558)
Co-authored-by: ondrejbardon <70531797+ondrejbardon@users.noreply.github.com>
2020-10-12 10:12:59 -04:00
Gordon Brown
5c8b0662df
Deprecate REST access to System Indices (#63274) (Original #60945)
This PR adds deprecation warnings when accessing System Indices via the REST layer. At this time, these warnings are only enabled for Snapshot builds by default, to allow projects external to Elasticsearch additional time to adjust their access patterns.

Deprecation warnings will be triggered by all REST requests which access registered System Indices, except for purpose-specific APIs which access System Indices as an implementation detail a few specific APIs which will continue to allow access to system indices by default:

- `GET _cluster/health`
- `GET {index}/_recovery`
- `GET _cluster/allocation/explain`
- `GET _cluster/state`
- `POST _cluster/reroute`
- `GET {index}/_stats`
- `GET {index}/_segments`
- `GET {index}/_shard_stores`
- `GET _cat/[indices,aliases,health,recovery,shards,segments]`

Deprecation warnings for accessing system indices take the form:
```
this request accesses system indices: [.some_system_index], but in a future major version, direct access to system indices will be prevented by default
```
2020-10-06 13:41:40 -06:00