Commit graph

35 commits

Author SHA1 Message Date
Alan Woodward
b2cf4757f3
Fix backwards description in runtime fields documentation (#94608) (#94642)
`runtime_mappings` is the name of the param in the search request. In the 
document `put` statement, it's called `runtime`

Co-authored-by: Matthew Hinea <matthew.hinea@gmail.com>
2023-03-22 11:53:35 -04:00
Dale Visser
1a9150dddb [Docs] Differentiate runtime field and indexed field (#91057)
Clarify wording of upgrading runtime fields to index field.
2023-01-13 17:05:26 +01:00
Christoph Büscher
8067f01d48
Runtime fields to optionally ignore script errors (#92380)
Currently Elasticsearch always returns a shard failure once a runtime error arises from using a runtime field, the exception being script-less runtime fields. This also means that execution of the query for that shard stops, which is okay for development and exploration. In a production scenario, however, it is often desirable to ignore runtime errors and continue with the query execution.

This change adds a new a new on_script_error parameter to runtime field definitions similar to the already existing
parameter for index-time scripted fields. When `on_script_error` is set to `continue`, errors from script execution are effectively ignored. This means affected documents don't show up in query results, but also don't prevent other matches from the same shard. Runtime fields accessed through the fields API don't return values on errors, aggregations will ignore documents that throw errors.

Note that this change affects scripted runtime fields only, while leaving default behaviour untouched. Also, ignored errors are not reported back to users for now.

Relates to #72143
2022-12-23 09:29:12 +01:00
Abdon Pijpelink
d0d2c74573
[DOCS] Clarify that lookup runtime sub-fields can't be used in queries and aggs (#91410) 2022-11-08 19:05:31 +01:00
saryeHaddadi
f66f10fe34
Fix confusion in runtime_mapping (#90999) 2022-11-08 14:16:41 +01:00
Christoph Büscher
4ae17d2dc6 Docs: Fix small typo in runtime.asciidoc (#90194)
A small grammar fix.
2022-09-22 11:34:27 +02:00
David Kilfoyle
992344a3fc
[Docs] Fix runtime grok script example (#87851)
* [Docs] Fix runtime grok script example

* Update runtime.asciidoc

Small fix.

* Update runtime.asciidoc

Small fix...

* Update common-script-uses.asciidoc

Small fix.

* Update docs/reference/scripting/common-script-uses.asciidoc

Co-authored-by: Adam Locke <adam.locke@elastic.co>

Co-authored-by: Adam Locke <adam.locke@elastic.co>
2022-07-05 10:53:24 -04:00
Luca Cavanna
7ee737ec01
Specify how to add fields from _source from a script (#88150)
Co-authored-by: freiit <freiit@users.noreply.github.com>
2022-07-05 11:54:36 +02:00
Adam Locke
7db1c807f2
Fix a linebreak (#86739) (#86742)
(cherry picked from commit 5ee3bbaa79)

Co-authored-by: Ugo Sangiorgi <ugo.sangiorgi@elastic.co>
2022-05-12 11:04:57 -04:00
Nhat Nguyen
31d703f24c
Introduce lookup runtime fields (#82385)
This PR introduces the lookup runtime fields which are used to retrieve 
data from the related indices. The below search request enriches its
search hits with the location of each IP address from the `ip_location`
index.

```
POST logs/_search
{
  "runtime_mappings": {
    "location": {
      "type": "lookup",
      "lookup_index": "ip_location",
      "query_type": "term",
      "query_input_field": "ip",
      "query_target_field": "_id",
      "fetch_fields": [
        "country",
        "city"
      ]
    }
  },
  "fields": [
    "timestamp",
    "message",
    "location"
  ]
}
```

Response:

```
{
  "hits": {
    "hits": [
      {
        "_index": "logs",
        "_id": "1",
        "fields": {
          "location": [
            {
              "city": [ "Montreal" ],
              "country": [ "Canada" ]
            }
          ],
          "message": [ "the first message" ]
        }
      }
    ]
  }
}
```
2022-02-22 21:36:19 -05:00
Colin Ng
dd2424b79c
Fix typo (#80925) 2021-11-23 16:28:53 -05:00
Adam Locke
7d61b0261c
[DOCS] Add composite runtime fields (#78050)
* [DOCS] Add composite runtime fields

* Update snippets and tests

* Add note that composite runtime fields cannot be indexed yet
2021-09-22 07:56:50 -04:00
Adam Locke
32e364d394
[DOCS] Clarify indexing a runtime field (#77117)
* [DOCS] Clarify indexing a runtime field

* Clarify wording based on reviewer feedback
2021-09-01 11:59:11 -04:00
Adam Locke
c9901429c2
[DOCS] Add retrieving runtime fields to introduction (#76084) 2021-08-04 11:17:28 -04:00
Adam Locke
b759c2fdd8
[DOCS] Word changes for runtime field incentives (#74769)
Incorporates feedback from #74454
2021-06-30 13:43:26 -04:00
Adam Locke
b890f9380c
[DOCS] Add performance info for runtime fields (#74454)
* [DOCS] Add performance info for runtime fields

* Add script-based sorting and clarify performance

* Changing title to Incentives and reworking the intro
2021-06-29 10:23:00 -04:00
Daisuke Harada
fa61bf814e
Update runtime.asciidoc (#73802)
it looks typo in a few numbers there.
2021-06-07 09:36:05 -04:00
Adam Locke
e2c470abed
[DOCS] Retrieve values from flattened fields w/ runtime fields (#73630)
* [DOCS] Add retriving from flattened fields

* Clarify sub-field syntax

* Moving sub-field retrieval to flattened field docs

* Remove full example and de-emphasize runtime fields

* Remove extraneous sample tag
2021-06-03 11:52:53 -04:00
Adam Locke
0aa0171ce1
[DOCS] Create a new page for grok content in scripting docs (#73118)
* [DOCS] Moving grok to its own scripting page

* Adding examples

* Updating cross link for grok page

* Adds same runtime field in a search request for #73262

* Clarify titles and shift navigation

* Incorporating review feedback

* Updating cross-link to Painless
2021-05-27 15:18:34 -04:00
Adam Locke
89ed0c8e29
[DOCS] Expand information on using a runtime field without a script (#73219)
* [DOCS] Expand information on when to use a runtime field without a script

* Reworking information based on review feedback

* Clarify case where doc_values are disabled

* A few minor changes from review feedback
2021-05-25 15:09:31 -04:00
Luca Cavanna
d8057bfe71
Rename on_script_error options to fail or continue (#71841)
As we started thinking about applying on_script_error to runtime fields, to handle script errors at search time, we would like to use the same parameter that was recently introduced for indexed fields. We decided that continue or fail gives a better indication of the behaviour compared to the current ignore or reject which is too specific to indexing documents.

This commit applies such rename.
2021-04-20 09:59:42 +02:00
Adam Locke
343c52c19f
[DOCS] Adding page for indexing runtime fields (#71366)
* [DOCS] Adding page for indexing runtime fields

* Fixing tests.

* Incorporating review feedback to enhance and improve examples.

* Changing note to indicate immutable script when indexing, plus adding on_script_error.
2021-04-07 13:07:39 -04:00
Adam Locke
14aba7bcff
[DOCS] Expand examples for runtime fields in a search query (#71237)
* Add warning admonition for removing runtime fields.

* Add cross-link to runtime fields.

* Expanding examples for runtime fields in a search request.

* Clarifying language and simplifying response tests.
2021-04-02 15:00:54 -04:00
Adam Locke
1ee4c50217
[DOCS] Remove beta admonition for runtime fields. (#69550)
* [DOCS] Remove beta admonition for runtime fields.

* Remove other beta admonition from Painless guide.
2021-02-24 11:35:11 -05:00
Adam Locke
2362549818
[DOCS] Adding grok support for runtime fields. (#69308)
* [DOCS] Adding grok support for runtime fields.

* Update response.

* Adding testresponse replacements.

* Update runtime field context and add dissect.

* Fixing backslash in the response.

* Fixing testresponse.

* Incorporating review feedback.

* Updates emit and adds cross link from ES runtime fields page.
2021-02-23 12:47:11 -05:00
James Rodewig
a85f9cade8
[DOCS] Use consistent @timestamp field name (#69435) (#69448)
Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>

Co-authored-by: Koji Kawamura <ijokarumawak@users.noreply.github.com>
2021-02-23 10:20:17 -05:00
S. J. Lee
42bca5bfc2
[DOCS] Relocate scriptless runtime document (#68916)
* Reallocate runtime document

Reallocate document `runtime-fields-scriptless` from `runtime-search-request` to `runtime-mapping-fields`

* Move runtime without script section

Move runtime without script section to under the dynamic runtime mapping section

* Fix snippet formatting and remove discrete heading.

* Update test snippet.

Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-02-17 12:38:06 -05:00
Luca Cavanna
bd3467a305
Add the ability to remove a runtime field (#68992)
Currently, existing runtime fields can be updated, but they cannot be removed. That allows to correct potential mistakes, but once a runtime field is added to the index mappings, it is not possible to remove it.

With this commit we introduce the ability to remove an existing runtime field by providing a null value for it through the put mapping API. If a field with such name does not exist, such specific instruction will have no effect on other existing runtime fields.

Note that the removal of runtime fields makes the recently introduced assertRefreshItNotNeeded assertion trip, because when each local node merges mappings back in, the runtime fields that were previously removed by the master node, get added back again locally. This is only a problem for the assertion that verifies that the removed refresh operation is never needed. We worked around this by tweaking the assertion to ignore runtime fields completely, for simplicity, by assertion on the serialized merged mappings and incoming mappings without the corresponding runtime section.

Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-02-16 21:00:16 +01:00
Adam Locke
c5c5d27fa7
[DOCS] Add beta admonition for runtime fields. (#67847)
* Add beta admonition for runtime fields.

* Add beta admonition to search your data page.
2021-01-21 17:10:37 -05:00
Adam Locke
1fb257545f
[DOCS] Add runtime fields to Painless Guide (#67781)
* Adding runtime fields page for Painless context.

* Adds beta admonition to runtime fields and Painless docs.

* Fixing test errors and improving content sections.

* Adding refresh to fix test cases.

* Simplifying the ingest request to include refresh.

* Removing beta (will add in another PR) and updating examples.
2021-01-21 15:52:01 -05:00
Adam Locke
744f7c67c8
[DOCS] 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>
2021-01-19 10:31:17 -05:00
Adam Locke
8f2df51829
[DOCS] Runtime fields improvements (#66530)
* Changes for dynamic templates.

* Clarifying language around dynamic:true and dynamic:runtime.

* Clarifying edits and some restructuring.

* Overhauling the Mapping page.

* Incorporating changes from #66911.

* Reworking mapping page to focus on dynamic vs. explicit mapping.

* Reordering to fix test failure.

* Further clarifying mapping page.

* Reordering sections, adding headings to examples, and other clarifications.

* Incorporating review feedback.

* Adding description of  for Painless script.
2021-01-11 12:31:26 -05:00
Adam Locke
4145d544e5
Incorporating changes from review. (#66346) (#66358) 2020-12-15 10:30:33 -05:00
Adam Locke
fe54c2ffd2
[DOCS] Add dynamic runtime fields to docs (#66194)
* [DOCS] Add dynamic runtime fields to docs.

* Clarifying edits and example changes.

* Creating better table and incorporating review comments.

* Change numeral to superscript.
2020-12-14 16:37:42 -05:00
Adam Locke
bce1081c73
[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.
2020-12-09 17:54:58 -05:00