Commit Graph

138 Commits

Author SHA1 Message Date
Adam Locke 56efbd83ce
[DOCS] Fixing field context examples (#76887) 2021-08-24 14:10:41 -04:00
Stef Nestor 828a36de75
Add frequently shared Painless field catch script (#75758)
Support frequently shares https://gist.github.com/jclosure/8e103dee2f7e9491845a2c0bb64c6b7a#gistcomment-3780127, adds into docs
2021-07-30 08:20:26 -04:00
Dan Hermann 01beb3f5d2
[DOCS] Expose community ID processor in Painless (#74306) 2021-06-21 14:21:51 -05:00
Dan Hermann 4e164c77ea
[DOCS] Expose URI parts processor in Painless (#73896) 2021-06-17 07:29:58 -05:00
James Rodewig 05256faa9a
[DOCS] Add missing anchor for script contexts (#73056) 2021-05-13 11:39:19 -04:00
Jack Conradson 5c6dae6125
[DOCS] Add runtime fields contexts to Painless execute API docs (#72131)
* add runtime fields contexts to execute docs

* Changes for formatting throughout

* Add missing context and context_setup

* Updating runtime field context

* Moving parameters and adopting a more standard API layout

* Update several examples

* Update more examples for runtime context

* Fix links

* Add boolean_field example and remove extraneous headings

* Add example for date_time context

* Remove extra space in TEST

* Updating date_time example

* Incorporating review feedback

* Adding cross links

* Tweaking some language based on feedback

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-05-13 10:49:29 -04:00
Dan Hermann 3a9223d321
[DOCS] Ingest methods for Painless (#72722) 2021-05-06 14:17:32 -05:00
Nik Everett 95f3bee07e
Document signature for runtime fields (#72630)
This documents the different signatures of the `emit` method for runtime
fields. For fields like `long` the signature is fairly obvious -
`emit(long)`. But for `date`, `ip`, and `geo_point` its not obvious from
the name what the signature of the method will be.


Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-05-03 16:37:53 -04:00
James Rodewig 693807a6d3
[DOCS] Fix double spaces (#71082) 2021-03-31 09:57:47 -04:00
Adam Locke aba4422606
[DOCS] Focus scripting docs on Painless (#69748)
* Initial changes for scripting.

* Shorten script examples.

* Expanding types docs.

* Updating types.

* Fixing broken cross-link.

* Fixing map error.

* Incorporating review feedback.

* Fixing broken table.

* Adding more info about reference types.

* Fixing broken path.

* Adding more info an examples for def type.

* Adding more info on operators.

* Incorporating review feedback.

* Adding notconsole for example.

* Removing comments in example.

* More review feedback.

* Editorial changes.

* Incorporating more reviewer feedback.

* Rewrites based on review feedback.

* Adding new sections for storing scripts and shortening scripts.

* Adding redirect for stored scripts.

* Adding DELETE for stored script plus link.

* Adding section for updating docs with scripts.

* Incorporating final feedback from reviews.

* Tightening up a few areas.

* Minor change around other languages.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-03-18 15:58:33 -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
Adam Locke a39eef6309
[DOCS] Fixing Painless tests (#68157)
* Fixing Painless tests.

* Update runtime field context to fix test cases.

* Remove watcher logging from usage API and replace test.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-02-09 11:24:14 -05:00
Alejandro Fernández Haro 307cbb1099
[DOCS] Fix small typo in concat examples (#68131)
Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
2021-01-28 14:53:35 -05:00
Adam Locke c91a808732
[DOCS] Update Painless examples to use seat data (#68029)
* Adds datetime as a date, which is necessary in setup.

* Updating field context example.

* Fixing sample data, updating context example, and updating runtime example.

* Updating field context and changing runtime field to use seats data.

* Update filter context to use the seats data.

* Updating min-should-match context to use seats data.

* Replacing last mentions of TEST[skip].

* Update usage with watcher response for build error.

* Updating usage API again for watcher.

* Third time's a charm for fixing test cases.

* Adding specific test replacement for watcher logging total.

* Change actors to keyword based on review feedback.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-01-27 16:42:22 -05:00
Adam Locke 7ae7227994
[DOCS] Enhance the seats dataset for Painless (#68008)
* Initial updates to the seats data.

* Enhance seats test in gradle.build.

* Updating bulk ingest example to use test data.

* Updating examples and context example intro.
2021-01-26 14:37:31 -05:00
Adam Locke 65e05938d0
[DOCS] Updating Painless context examples. (#67935) 2021-01-25 14:51:13 -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
James Rodewig 251bff5ade
[DOCS] Fix typo (#67230) (#67395)
Co-authored-by: Łukasz Grajewski <grajewski.lukasz@wp.pl>
2021-01-12 16:25:05 -05:00
Bhavya Gupta ae69472c78 Updated painless-walkthrough documentation (#65530)
Update documentation about regex note.
2020-12-02 09:28:42 -08:00
Mayya Sharipova ca5de06b0c
Correct format in analysis-predicate-context 2020-11-09 16:27:06 -05:00
mushao999 08dc3d90f5
[DOCS] Fix plainess-datetime example script error (#62811) 2020-09-29 13:06:54 -04:00
James Rodewig a94e5cb7c4
[DOCS] Replace Wikipedia links with attribute (#61171) 2020-08-17 09:44:24 -04:00
James Rodewig 6b9b8c5e31
[DOCS] Move script and stored fields content to search fields page (#60826)
Changes:

* Moves `Retrieve selected fields` to its own page and adds a title abbreviation.
* Adds existing script and stored fields content to `Retrieve selected fields`
* Adds a xref for `Retrieve selected fields` to `Search your data`
* Adds related redirects and updates existing xrefs
2020-08-06 12:45:03 -04:00
Alexander Reelsen c7ac9e7073
[DOCS] http -> https, remove outdated plugin docs (#60380)
Plugin discovery documentation contained information about installing
Elasticsearch 2.0 and installing an oracle JDK, both of which is no
longer valid.

While noticing that the instructions used cleartext HTTP to install
packages, this commit replaces HTTPs links instead of HTTP where possible.

In addition a few community links have been removed, as they do not seem
to exist anymore.
2020-07-31 15:58:38 -04:00
James Rodewig 441c3a21b1
[DOCS] Update my-index examples (#60132)
Changes the following example index names to `my-index-000001` for consistency:

* `my-index`
* `my_index`
* `myindex`
2020-07-27 14:46:39 -04:00
James Rodewig d5b03f668b
[DOCS] Move search sort docs to separate page (#60123)
Moves the search sort docs from the deprecated 'Request Body Search'
page to a new subpage of 'Run a search'.

No substantive changes were made to the content.
2020-07-23 12:58:57 -04:00
James Rodewig 2774cd6938
[DOCS] Swap `[float]` for `[discrete]` (#60124)
Changes instances of `[float]` in our docs for `[discrete]`.

Asciidoctor prefers the `[discrete]` tag for floating headings:
https://asciidoctor.org/docs/asciidoc-asciidoctor-diffs/#blocks
2020-07-23 11:48:22 -04:00
James Rodewig 8a57800f1b
[DOCS] Add performance warning for scripts (#59890) 2020-07-20 14:04:35 -04:00
James Rodewig a390e6d7be
[DOCS] Reformat Painless snippets to use two-space indents (#59776) 2020-07-17 11:03:19 -04:00
Stuart Tettemer 352a90c5d8
Scripting: Update ctx docs with sha augment (#59719) 2020-07-16 12:51:47 -05:00
Stuart Tettemer 3057e0fbd1
Scripting: fix generateContextDoc path and url (#59676)
* Add doc runtime class path
* Use `getAllHttpSocketURI.get(0)` instead of `getAllHttpSocketURI` to get a single
  test cluster URL rather than a list
2020-07-15 17:48:14 -05:00
debadair 9dce026e06
[DOCS] Fixes terminology in the Painless docs (#58179) 2020-06-16 10:44:30 -07:00
Matthias Gärtner f760d327f8
Off-by-ones on data sizes in documentation (#57735)
Fixes exponent off-by-ones in Painless documentation for int and long.
2020-06-12 09:57:53 -07: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
renshuki a6b4a43fc1 [DOCS] Add more examples to Painless statements (#48397)
Add more examples to the Painless statements documentation (including while and do...while) as requested in #47485 (review)
2020-05-11 10:22:24 -07:00
Alan Woodward cbf6e162c5
Remove references to mapping type in painless ingest and update scripts (#54499)
Painless scripts no longer make the mapping type of a document available for
reference or mutation; however, there are still some references to the _type
field in the documentation for a number of script contexts. This commit removes
these references, and additionally stops emitting deprecation messages when
a script tries to get the _type field.
2020-03-31 16:25:44 +01:00
Stuart Tettemer 0c52a921d6
Docs: Use splitOnToken instead of custom function (#48408)
Painless ingest example uses a custom split function but
new splitOnToken function was added in 7.2
2020-03-27 14:14:20 -06:00
James Rodewig 9f641dc07d
[DOCS] Fix several Asciidoctor double arrow replacements (#52827)
Per the [Asciidoctor docs][0], Asciidoctor replaces the following
syntax with double arrows in the rendered HTML:

* => renders as ⇒
* <= renders as ⇐

This escapes several unintended replacements, such as in the Painless
docs.

Where appropriate, it also replaces some double arrow instances with
single arrows for consistency.

[0]: https://asciidoctor.org/docs/user-manual/#replacements
2020-03-04 08:42:37 -05:00
Stuart Tettemer 4a8e5ada23
Scripting: Add char position of script errors (#51069)
Add the character position of a scripting error to error responses.

The contents of the `position` field are experimental and subject to
change.  Currently, `offset` refers to the character location where the
error was encountered, `start` and `end` define a range of characters
that contain the error.

eg.
```
{
  "error": {
    "root_cause": [
      {
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "y = x;",
          "     ^---- HERE"
        ],
        "script": "def x = new ArrayList(); Map y = x;",
        "lang": "painless",
        "position": {
          "offset": 33,
          "start": 29,
          "end": 35
        }
      }
```

Refs: #50993

* Check position only for 7.7+

* 7.7 && decrement before assign

* Use correct experimental tag, update doc test responses, off by one yaml

* Do not duplicate error.caused_by in replacement

* Add position under causedby
2020-01-21 10:57:09 -07:00
Valentin Crettaz f8e41edd69 [DOCS] Fixed typos (_op => op) in Painless context docs (#50301) 2020-01-08 10:52:43 -06:00
James Rodewig f1bced7f7b
[DOCS] Correct typos in Painless datetime docs (#50563)
Fixes several typos and grammar errors raised by @glenacota in #47512.

Co-authored-by: Guido Lena Cota <guido.lenacota@gmail.com>
2020-01-02 13:13:00 -05:00
riverbuilding 66959be69e [DOCS] Correct Painless operator typos (#50472) 2019-12-30 08:48:10 -05:00
James Rodewig 529d3d5a91
[DOCS] Fix search request body link (#50498) 2019-12-26 12:32:27 -05:00
Xiang Dai 432bd0e92c Fix docs typos (#50365)
Fixes a few typos in the docs.

Signed-off-by: Xiang Dai 764524258@qq.com
2019-12-23 10:35:14 -05:00
James Rodewig d12637a3b2
[DOCS] Correct `for in` example in Painless docs (#49991)
Adds a needed `def` keyword to the `for in` example in the Painless docs.
2019-12-09 11:04:20 -05:00
Julie Tibshirani 460d545921
Remove support for sparse vectors. (#48781)
Follow up to #48368. This PR removes support for `sparse_vector` on new
indices. On 7.x indices a `sparse_vector` can still be defined, but it is not
possible to index or search on it.
2019-11-14 16:54:48 -05:00
Julie Tibshirani f863dd12b4
Update the signature of vector script functions. (#48604)
Previously the functions accepted a doc values reference, whereas they now
accept the name of the vector field. Here's an example of how a vector function
was called before and after the change.

```
Before: cosineSimilarity(params.query_vector, doc['field'])
After:  cosineSimilarity(params.query_vector, 'field')
```

This seems more intuitive, since we don't allow direct access to vector doc
values and the the meaning of `doc['field']` is unclear.

The PR makes the following changes (broken into distinct commits):
* Add new function signatures of the form `function(params.query_vector,
'field')` and deprecates the old ones. Because Painless doesn't allow two
methods with the same name and number of arguments, we allow a generic `Object`
to be passed in to the function and decide on the behavior through an
`instanceof` check.
* Refactor the class bindings so that the document field is passed to the
constructor instead of the instance method. This allows us to avoid retrieving
the vector doc values on every function invocation, which gives a tiny speed-up
in benchmarks.

Note that this PR adds new signatures for the sparse vector functions too, even
though sparse vectors are deprecated. It seemed simplest to understand (for both
us and users) to keep everything symmetric between dense and sparse vectors.
2019-10-29 13:26:36 -07:00