Commit graph

155 commits

Author SHA1 Message Date
Simon Cooper
a36d90cf34
Use CLDR locale provider on JDK 23+ (#110222)
JDK 23 removes the COMPAT locale provider, leaving CLDR as the only option. This commit configures Elasticsearch
to use the CLDR provider when on JDK 23, but still use the existing COMPAT provider when on JDK 22 and below.

This causes some differences in locale behaviour; this also adapts various tests to still work whether run on COMPAT or CLDR.
2024-09-04 13:42:40 +01:00
Benjamin Trent
acc99302c6
Adding hamming distance function to painless for dense_vector fields (#109359)
This adds `hamming` distances, the pop-count of `xor` byte vectors as a
first class citizen in painless. 

For byte vectors, this means that we can compute hamming distances via
script_score (aka, brute-force).

The implementation of `hamming` is the same that is available in Lucene,
and when lucene 9.11 is merged, we should update our logic where
applicable to utilize it.

NOTE: this does not yet add hamming distance as a metric for indexed
vectors. This will be a future PR after the Lucene 9.11 upgrade.
2024-06-18 03:41:20 +10:00
Benjamin Trent
53aefdd79d
add hexstring support byte painless scorers (#109492)
Hexidecimal strings are supported for index input and for kNN queries. We should support them for byte vectors in painless.

This commit addresses this for our common scoring functions.

closes: #109412
2024-06-11 15:04:38 -04:00
Michael Peterson
335c03afa9
Handle unmatching remote cluster wildcards properly for IndicesRequest.SingleIndexNoWildcards requests (#109185)
When security is enabled and a IndicesRequest.SingleIndexNoWildcards request uses a wildcard for 
remote clusters that does not match (for example "*:myindex" when there are no configured remotes),
RBACEngine#authorizeIndexAction throws an assert error because it is given an empty list of indices.

This fix checks the IndicesRequest.SingleIndexNoWildcards special case in
IndicesAndAliasesResolver.resolveIndicesAndAliasesWithoutWildcards
and if splitLocalAndRemoteIndexNames filters out all indexes due to a non-matching remote cluster 
wildcard, that code now just throws the NoSuchRemoteClusterException (which is what RBACEngine
does when asserts are disabled).

This handles painless/execute requests to remote clusters.

Added note to painless/execute API docs about wildcards not being allowed
2024-06-10 08:56:40 -04:00
sunyoung-dev
df9002acca
[DOCS] Fix painless context _id variable (#101316) 2023-11-01 11:31:03 -07:00
Jeff Huss
81bddc05b9
Update painless-walkthrough.asciidoc (#99263)
Simple typo on line # 119 - "writting" -> "writing"
2023-09-07 10:23:35 +02:00
Michael Peterson
6dd1841dbc
Allow users to run the painless execute API on a remote cluster shard (#97335)
Added a clusterAlias to the Painless execute Request object, so that index
expressions in the request of the form "myremote:myindex" will be parsed to
set clusterAlias to "myremote" and the index to "myindex".

If clusterAlias is null, then it is executed against a shard on the local cluster, as before.
If clusterAlias is non-null, then the SingleShardTransportAction is sent to the remote cluster,
where it will run the full request (doing remote coordination). Note that the new clusterAlias 
field is not Writeable so that when it is sent to the remote cluster it will only see the index
name, not the clusterAlias (which it wouldn't know how to handle correctly).

Added PainlessExecuteIT test that tests cross-cluster calls

Updated painless-execute-script end user docs to indicate support for cross-cluster executions
2023-07-10 12:27:00 -04:00
debadair
777598d602
[DOCS] Remove redirect pages (#88738)
* [DOCS] Remove manual redirects

* [DOCS] Removed refs to modules-discovery-hosts-providers

* [DOCS] Fixed broken internal refs

* Fixing bad cross links in ES book, and adding redirects.asciidoc[] back into docs/reference/index.asciidoc.

* Update docs/reference/search/point-in-time-api.asciidoc

Co-authored-by: James Rodewig <james.rodewig@elastic.co>

* Update docs/reference/setup/restart-cluster.asciidoc

Co-authored-by: James Rodewig <james.rodewig@elastic.co>

* Update docs/reference/sql/endpoints/translate.asciidoc

Co-authored-by: James Rodewig <james.rodewig@elastic.co>

* Update docs/reference/snapshot-restore/restore-snapshot.asciidoc

Co-authored-by: James Rodewig <james.rodewig@elastic.co>

* Update repository-azure.asciidoc

* Update node-tool.asciidoc

* Update repository-azure.asciidoc

---------

Co-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Amy Jonsson <amy.jonsson@elastic.co>
Co-authored-by: James Rodewig <james.rodewig@elastic.co>
2023-05-24 12:32:46 +01:00
Ugo Sangiorgi
05ddc587fb
Fix ZonedDateTime example code (#93235)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2023-02-14 15:13:06 +01:00
Iraklis Psaroudakis
011e3bcdb9
Mention full location of document _source (#89940) (#90013)
Co-authored-by: David Gilman <dgilman@aidentified.com>
2022-09-12 21:50:24 +03:00
Nik Everett
3bcee8eaa0
Format runtime geo_points (#85449)
This formats the result of the `fields` section of the `_search` API for
runtime `geo_point` fields using the `format` parameter like we do for
non-runtime `geo_point` fields. This changes the default format for
those fields from `lat, lon` to `geojson` with the option to get `wkt`
or any other format we support.

The fix does so by preserving the `double, double` nature of the
`geo_point` rather than encoding it immediately in the script. Callers can
use the results. The field fetchers use the `double, double` natively,
preserving as much precision as possible. The queries quantize the points
exactly like lucene indexing does. And like the script did before this Pr.

Closes #85245
2022-07-27 13:11:07 -04:00
Craig Taverner
68f432275d
Added documentation on GeoJSON format for points and geo-points (#86066)
* Added documentation on GeoJSON format for points

And geo-points.

* Fixed some small mistakes in painless geo-point
2022-04-28 10:41:07 +02:00
Luca Cavanna
fe02e4fe22
[DOCS] add composite field context to the painless execute docs (#85513)
The painless execute API supports the composite_field context since the composite field was added.
This commit adds docs for it where missing.

Relates to #78050
2022-04-19 16:14:34 +02:00
jalvar08
6f7c158288
Update painless-reindex-context.asciidoc (#84444)
ctx['op'] should be set to 'noop', not 'none' when specifying no
operation.

Elasticsearch error when using 'none':

```json
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "Operation type [none] not allowed, only [noop, index, delete] are allowed"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "Operation type [none] not allowed, only [noop, index, delete] are allowed"
  },
  "status" : 400
}
```
2022-03-07 12:14:07 -05:00
Tobias Stadler
e3deacf547
[DOCS] Fix typos (#83895) 2022-02-15 12:42:17 -05:00
Lukas Wegmann
8bcbebbf0d
[DOCS] Mention option to return String in sort context (#76105)
* Painless: Mention option to return String in sort context

* Adjust wording
2021-10-11 14:48:50 -04:00
Jack Conradson
086ba1aefb
Remove JodaCompatibleZonedDateTime (#78417)
This change removes JodaCompatibleZonedDateTime and replaces it with ZonedDateTime for use in 
scripting.

Breaking changes:
* JodaCompatibleDateTime no longer exists and cannot be cast to in Painless. Use ZonedDateTime 
instead.
* The dayOfWeek method on ZonedDateTime returns the DayOfWeek enum instead of an int from 
JodaCompatibleDateTime. dayOfWeekEnum still exists on ZonedDateTime as an augmentation to 
support the transition to ZonedDateTime, but is now deprecated in favor of dayOfWeek on 
ZonedDateTime.
2021-09-29 13:01:40 -07:00
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