Commit Graph

124 Commits

Author SHA1 Message Date
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
Guido Lena Cota 1d24800482 [DOCS] Fix typos in Painless execute API docs(#47518) 2019-10-18 10:30:34 -04:00
Francois-Clement Brossard 2288052d08 [DOCS] Update painless statements with if/else example (#47485) 2019-10-03 15:23:33 -04:00
Lisa Cawley 91992a805f
[DOCS] Moves Watcher content into Elasticsearch book (#47147)
Co-Authored-By: James Rodewig <james.rodewig@elastic.co>
2019-09-27 16:05:44 -07:00
James Rodewig 5772c1c7dd
[DOCS] [2 of 5] Change // CONSOLE comments to [source,console] (#46353) 2019-09-09 13:13:41 -04:00
James Rodewig e43be90e6c
[DOCS] [5 of 5] Change // TESTRESPONSE comments to [source,console-results] (#46449) 2019-09-06 14:05:36 -04:00
Nik Everett 948cdab15a
Build: Enable testing without magic comments (#46180)
Previously we only turned on tests if we saw either `// CONSOLE` or
`// TEST`. These magic comments are difficult for the docs build to deal
with so it has moved away from using them where possible. We should
catch up. This adds another trigger to enable testing: marking a snippet
with the `console` language. It looks like this:

```
[source,console]
----
GET /
----
```

This saves a line which is nice, I guess. But it is more important to me
that this is consistent with the way the docs build works now.

Similarly this enables response testing when you mark a snippet with the
language `console-result`. That looks like:
```
[source,console-result]
----
{
  "result": "0.1"
}
----
```

`// TESTRESPONSE` is still available for situations like `// TEST`: when
the response isn't *in* the console-result language (like `_cat`) or
when you want to perform substitutions on the generated test.

Should unblock #46159.
2019-09-04 11:23:29 -04:00
Jack Conradson 85783367dd
Fix Watcher Examples in Painless (#45631)
This fixes the mappings and types required to run watcher and other 
examples. A new set of seat data will be updated and available for 
download to go with this change.
2019-08-16 08:32:18 -07:00
Jack Conradson 796dec34c8
Add several context examples for Painless date documentation (#44985) 2019-07-31 08:21:46 -07:00
James Rodewig ea1adb61c2
[DOCS] Update anchors and links for Elasticsearch API relocation (#44500) 2019-07-19 09:16:35 -04:00
James Rodewig e5a3ae97e2 Revert "[DOCS] Fix broken links for ES API docs move (#44279)"
This reverts commit 3bdd2f4432.
2019-07-12 17:06:51 -04:00
James Rodewig 3bdd2f4432
[DOCS] Fix broken links for ES API docs move (#44279)
* [DOCS] Fix broken links for ES API docs move

Co-Authored-By: Lisa Cawley <lcawley@elastic.co>
2019-07-12 12:46:22 -04:00
Jack Conradson 7527157a51
Add Datetime Now to Painless Documentation (#43852)
This change explains why Painless doesn't natively support datetime now, and 
gives examples of how to create a version of now through user-defined 
parameters.
2019-07-02 15:38:16 -07:00
Jack Conradson c1acc6931d
Add timezone documentation for Painless datetimes (#43768) 2019-07-01 21:29:01 -07:00
James Rodewig e63e755744 [DOCS] Add redirect for painless examples anchor 2019-06-25 12:37:21 -04:00