-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Painless: Add Context Docs #31190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Painless: Add Context Docs #31190
Changes from 114 commits
Commits
Show all changes
116 commits
Select commit
Hold shift + click to select a range
153d376
Separate identifiers into its own section. Clean up variables.
jdconrad 6729d5f
More docs.
jdconrad 84048e4
Merge branch 'master' into docs1
jdconrad 10fca6c
Merge branch 'master' into docs1
jdconrad c2c3448
Modify language used to describe shallow copies.
jdconrad 1cdf013
Move examples into lists to make sections flow better when multiple
jdconrad 862962b
Update primitive types.
jdconrad 73883ac
Cleaned up reference types.
jdconrad 7dfb034
Clean up dynamic types.
jdconrad 75f1498
String and void type clean up.
jdconrad f75d50e
Merge branch 'master' into docs2
jdconrad 956a188
Merge branch 'master' into docs2
jdconrad bce78ed
Fixes.
jdconrad b034cff
Merge branch 'master' into docs2
jdconrad e82a1e0
Clean up types section.
jdconrad 1da1704
Merge branch 'master' into docs2
jdconrad 48b3aee
Merge branch 'master' into docs3
jdconrad 8bc0c74
Some casting and example clean up.
jdconrad 275c2e7
Merge branch 'master' into docs3
jdconrad 00ba531
Updated examples.
jdconrad 7bcd114
More changes.
jdconrad 84ea43d
Merge branch 'master' into docs3
jdconrad 1cf2f0b
Merge branch 'master' into docs3
jdconrad 68059ae
More example clean up.
jdconrad 73a24f0
More casting clean up.
jdconrad c3fcd67
More clean up.
jdconrad 19abc56
More changes.
jdconrad 00cf5df
Merge branch 'master' into docs3
jdconrad 0cb3e66
More fixes.
jdconrad bc4509f
Merge branch 'master' into docs3
jdconrad 507ac48
More example clean up.
jdconrad 7ad4ebb
More changes.
jdconrad a9c941e
Finished promotion and boxing/unboxing.
jdconrad 0007d26
Merge branch 'master' into docs2
jdconrad 988fc23
Cleaned up casting basic on PR comments.
jdconrad b95ce25
More changes.
jdconrad a8ed00b
Merge branch 'master' into docs2
jdconrad 7b73010
More fixes.
jdconrad 8fc4566
Fixed casting and types based on PR feedback.
jdconrad ca2bb83
Cleaned up more.
jdconrad ae1ae75
Extra blank lines at end of docs.
jdconrad a5cc47a
Merge branch 'master' into docs2
jdconrad 7b70e15
Start of structural change for operators.
jdconrad 093a10f
Moved operations to the appropriate pages.
jdconrad bb4dc1c
More clean up.
jdconrad 8f9b09e
Merge branch 'master' into docs5
jdconrad a122212
Added a casting table.
jdconrad 2665835
Switch assign/access to store/load in examples.
jdconrad aeb879b
Cleaned up some of the general operators.
jdconrad 7165b0f
Merge branch 'master' into docs5
jdconrad ba4b7c1
Merge branch 'master' into docs5
jdconrad b0c2512
Merge branch 'master' into docs5
jdconrad b1d31d1
Clean up of general operators.
jdconrad 246c824
Fix examples with load from instead of load.
jdconrad 4e2b89d
Update structure for long-term spec goals.
jdconrad 8b5316b
Merge branch 'master' into docs5
jdconrad 8302de3
Clean up numerical operators.
jdconrad 7ad8379
Merge branch 'master' into docs5
jdconrad 1d64edd
Merge branch 'docs5' into docs6
jdconrad 0696c83
Partially completed clean up of reference type operators.
jdconrad 46a868e
Completion of clean up of reference type operators.
jdconrad 15aac91
Clean up of array operators section.
jdconrad f85e235
Partially completed boolean operators clean up.
jdconrad 6f16058
More clean up.
jdconrad 775cfff
More clean up.
jdconrad 610d67c
Completion of operators clean up.
jdconrad 3b8da65
Fix Java to Painless.
jdconrad 33b7357
Merge branch 'master' into docs5
jdconrad d17c365
Merge branch 'master' into docs5
jdconrad a2afc62
Merge branch 'docs5' into docs6
jdconrad 8c87bf9
Merge branch 'docs6' into docs7
jdconrad 5b19038
Merge branch 'docs7' into docs8
jdconrad 46f737f
Merge branch 'docs8' into docs9
jdconrad e486275
Add structure for context information in Painless.
jdconrad 9439b92
Fix missing lang.
jdconrad 5aaa88a
Merge branch 'docs5' into docs6
jdconrad 86591c3
Merge branch 'docs6' into docs7
jdconrad d54e4a0
Fix missing lang.
jdconrad 23c2320
Merge branch 'docs7' into docs8
jdconrad fba0246
Merge branch 'docs8' into docs9
jdconrad 6d84e12
Added some docs for update context.
jdconrad 5a7257b
Added info for update and update by query contexts.
jdconrad 73ff8a2
Fix missing lang.
jdconrad 2b55029
Merge branch 'master' into docs5
jdconrad bdb8eb1
Merge branch 'docs5' into docs6
jdconrad 4e2994a
Merge branch 'docs6' into docs7
jdconrad a570d37
Merge branch 'docs7' into docs8
jdconrad 2e38982
Merge branch 'docs8' into docs9
jdconrad f2efb10
Merge branch 'docs9' into docs10
jdconrad 493c06b
Minor correction.
jdconrad a8c037f
Added score, similarity, and weight context variables.
jdconrad a0c1bf6
More progress on contexts.
jdconrad c688199
Response to PR review.
jdconrad 542f52e
Merge branch 'master' into docs5
jdconrad e0e7dce
Merge branch 'docs5' into docs6
jdconrad 603e5e5
PR response to numeric operators.
jdconrad afdc961
Merge branch 'docs6' into docs7
jdconrad 12fb54d
Response to PR comments for reference operators.
jdconrad c83ecaf
Merge branch 'docs7' into docs8
jdconrad be37bf1
Cleaned up array operators based on PR feedback.
jdconrad f0bd472
Merge branch 'docs8' into docs9
jdconrad c35e977
Clean up boolean operators based on PR feedback.
jdconrad 0760a41
Accidentally left in modified test.
jdconrad 8fdad77
Merge branch 'docs9' into docs10
jdconrad 0c8925e
Merge branch 'docs5' into docs10
jdconrad cce74a5
Partial progress on aggs contexts.
jdconrad dd14914
Merge branch 'master' into docs10
jdconrad 6a4e8de
Finished metric agg contexts.
jdconrad f182434
More changes.
jdconrad 48033af
Finished transform context.
jdconrad d1366dc
Merge branch 'master' into docs10
jdconrad 85af2a1
Bit of clean up.
jdconrad 452cf50
Merge branch 'master' into docs10
jdconrad 7659bb9
Merge branch 'master' into docs10
jdconrad 55018e7
Merge branch 'master' into docs10
jdconrad 18b35a5
Response to PR feedback.
jdconrad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[[painless-contexts]] | ||
== Painless Contexts | ||
|
||
:es_version: https://www.elastic.co/guide/en/elasticsearch/reference/master | ||
:xp_version: https://www.elastic.co/guide/en/x-pack/current | ||
|
||
A Painless script is evaluated within a context. Each context has values that | ||
are available as local variables, a whitelist that controls the available | ||
classes, and the methods and fields within those classes (API), and | ||
if and what type of value is returned. | ||
|
||
A Painless script is typically executed within one of the contexts in the table | ||
below. Note this isn't necessarily a comprehensive list as custom plugins and | ||
specialized code may define new ways to use a Painless script. | ||
|
||
[options="header",cols="<1,<1,<1"] | ||
|==== | ||
| Name | Painless Documentation | ||
| Elasticsearch Documentation | ||
| Update | <<painless-update-context, Painless Documentation>> | ||
| {es_version}/docs-update.html[Elasticsearch Documentation] | ||
| Update By Query | <<painless-update-by-query-context, Painless Documentation>> | ||
| {es_version}/docs-update-by-query.html[Elasticsearch Documentation] | ||
| Reindex | <<painless-reindex-context, Painless Documentation>> | ||
| {es_version}/docs-reindex.html[Elasticsearch Documentation] | ||
| Sort | <<painless-sort-context, Painless Documentation>> | ||
| {es_version}/search-request-sort.html[Elasticsearch Documentation] | ||
| Similarity | <<painless-similarity-context, Painless Documentation>> | ||
| {es_version}/index-modules-similarity.html[Elasticsearch Documentation] | ||
| Weight | <<painless-similarity-context, Painless Documentation>> | ||
| {es_version}/index-modules-similarity.html[Elasticsearch Documentation] | ||
| Score | <<painless-score-context, Painless Documentation>> | ||
| {es_version}/query-dsl-function-score-query.html[Elasticsearch Documentation] | ||
| Field | <<painless-field-context, Painless Documentation>> | ||
| {es_version}/search-request-script-fields.html[Elasticsearch Documentation] | ||
| Filter | <<painless-filter-context, Painless Documentation>> | ||
| {es_version}/query-dsl-script-query.html[Elasticsearch Documentation] | ||
| Minimum Should Match | <<painless-min-should-match-context, Painless Documentation>> | ||
| {es_version}/query-dsl-terms-set-query.html[Elasticsearch Documentation] | ||
| Metric Aggregation Initialization | <<painless-metric-agg-init-context, Painless Documentation>> | ||
| {es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation] | ||
| Metric Aggregation Map | <<painless-metric-agg-map-context, Painless Documentation>> | ||
| {es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation] | ||
| Metric Aggregation Combine | <<painless-metric-agg-combine-context, Painless Documentation>> | ||
| {es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation] | ||
| Metric Aggregation Reduce | <<painless-metric-agg-reduce-context, Painless Documentation>> | ||
| {es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[Elasticsearch Documentation] | ||
| Bucket Aggregation | <<painless-bucket-agg-context, Painless Documentation>> | ||
| {es_version}/search-aggregations-pipeline-bucket-script-aggregation.html[Elasticsearch Documentation] | ||
| Ingest Processor | <<painless-ingest-processor-context, Painless Documentation>> | ||
| {es_version}/script-processor.html[Elasticsearch Documentation] | ||
| Watcher Condition | <<painless-watcher-condition-context, Painless Documentation>> | ||
| {xp_version}/condition-script.html[Elasticsearch Documentation] | ||
| Watcher Transform | <<painless-watcher-transform-context, Painless Documentation>> | ||
| {xp_version}/transform-script.html[Elasticsearch Documentation] | ||
|==== | ||
|
||
include::painless-contexts/index.asciidoc[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
include::painless-update-context.asciidoc[] | ||
|
||
include::painless-update-by-query-context.asciidoc[] | ||
|
||
include::painless-reindex-context.asciidoc[] | ||
|
||
include::painless-sort-context.asciidoc[] | ||
|
||
include::painless-similarity-context.asciidoc[] | ||
|
||
include::painless-weight-context.asciidoc[] | ||
|
||
include::painless-score-context.asciidoc[] | ||
|
||
include::painless-field-context.asciidoc[] | ||
|
||
include::painless-filter-context.asciidoc[] | ||
|
||
include::painless-min-should-match-context.asciidoc[] | ||
|
||
include::painless-metric-agg-init-context.asciidoc[] | ||
|
||
include::painless-metric-agg-map-context.asciidoc[] | ||
|
||
include::painless-metric-agg-combine-context.asciidoc[] | ||
|
||
include::painless-metric-agg-reduce-context.asciidoc[] | ||
|
||
include::painless-bucket-agg-context.asciidoc[] | ||
|
||
include::painless-ingest-processor-context.asciidoc[] | ||
|
||
include::painless-watcher-condition-context.asciidoc[] | ||
|
||
include::painless-watcher-transform-context.asciidoc[] |
21 changes: 21 additions & 0 deletions
21
docs/painless/painless-contexts/painless-bucket-agg-context.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[[painless-bucket-agg-context]] | ||
=== Bucket Aggregation Context | ||
|
||
Use a Painless script in an | ||
{es_version}/search-aggregations-pipeline-bucket-script-aggregation.html[bucket aggregation] | ||
to calculate a value as a result in a bucket. | ||
|
||
*Variables* | ||
|
||
`params` (`Map`, read-only):: | ||
User-defined parameters passed in as part of the query. The parameters | ||
include values defined as part of the `buckets_path`. | ||
|
||
*Return* | ||
|
||
numeric:: | ||
The calculated value as the result. | ||
|
||
*API* | ||
|
||
The standard <<painless-api-reference, Painless API>> is available. |
31 changes: 31 additions & 0 deletions
31
docs/painless/painless-contexts/painless-field-context.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[[painless-field-context]] | ||
=== Field Context | ||
|
||
Use a Painless script to create a | ||
{es_version}/search-request-script-fields.html[script field] to return | ||
a customized value for each document in the results of a query. | ||
|
||
*Variables* | ||
|
||
`params` (`Map`, read-only):: | ||
User-defined parameters passed in as part of the query. | ||
|
||
`doc` (`Map`, read-only):: | ||
Contains the fields of the specified document where each field is a | ||
`List` of values. | ||
|
||
{es_version}/mapping-source-field.html[`ctx['_source']`] (`Map`):: | ||
Contains extracted JSON in a `Map` and `List` structure for the fields | ||
existing in a stored document. | ||
|
||
`_score` (`double` read-only):: | ||
The original score of the specified document. | ||
|
||
*Return* | ||
|
||
`Object`:: | ||
The customized value for each document. | ||
|
||
*API* | ||
|
||
The standard <<painless-api-reference, Painless API>> is available. |
26 changes: 26 additions & 0 deletions
26
docs/painless/painless-contexts/painless-filter-context.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[[painless-filter-context]] | ||
=== Filter Context | ||
|
||
Use a Painless script as a {es_version}/query-dsl-script-query.html[filter] in a | ||
query to include and exclude documents. | ||
|
||
|
||
*Variables* | ||
|
||
`params` (`Map`, read-only):: | ||
User-defined parameters passed in as part of the query. | ||
|
||
`doc` (`Map`, read-only):: | ||
Contains the fields of the current document where each field is a | ||
`List` of values. | ||
|
||
*Return* | ||
|
||
`boolean`:: | ||
Return `true` if the current document should be returned as a result of | ||
the query, and `false` otherwise. | ||
|
||
|
||
*API* | ||
|
||
The standard <<painless-api-reference, Painless API>> is available. |
41 changes: 41 additions & 0 deletions
41
docs/painless/painless-contexts/painless-ingest-processor-context.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[[painless-ingest-processor-context]] | ||
=== Ingest Processor Context | ||
|
||
Use a Painless script in an {es_version}/script-processor.html[ingest processor] | ||
to modify documents upon insertion. | ||
|
||
*Variables* | ||
|
||
`params` (`Map`, read-only):: | ||
User-defined parameters passed in as part of the query. | ||
|
||
{es_version}/mapping-index-field.html[`ctx['_index']`] (`String`):: | ||
The name of the index. | ||
|
||
{es_version}/mapping-type-field.html[`ctx['_type']`] (`String`):: | ||
The type of document within an index. | ||
|
||
`ctx` (`Map`):: | ||
Contains extracted JSON in a `Map` and `List` structure for the fields | ||
that are part of the document. | ||
|
||
*Side Effects* | ||
|
||
{es_version}/mapping-index-field.html[`ctx['_index']`]:: | ||
Modify this to change the destination index for the current document. | ||
|
||
{es_version}/mapping-type-field.html[`ctx['_type']`]:: | ||
Modify this to change the type for the current document. | ||
|
||
`ctx` (`Map`, read-only):: | ||
Modify the values in the `Map/List` structure to add, modify, or delete | ||
the fields of a document. | ||
|
||
*Return* | ||
|
||
void:: | ||
No expected return value. | ||
|
||
*API* | ||
|
||
The standard <<painless-api-reference, Painless API>> is available. |
27 changes: 27 additions & 0 deletions
27
docs/painless/painless-contexts/painless-metric-agg-combine-context.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[[painless-metric-agg-combine-context]] | ||
=== Metric Aggregation Combine Context | ||
|
||
Use a Painless script to | ||
{es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[combine] | ||
values for use in a scripted metric aggregation. A combine script is run once | ||
per shard following a <<painless-metric-agg-map-context, map script>> and is | ||
optional as part of a full metric aggregation. | ||
|
||
*Variables* | ||
|
||
`params` (`Map`, read-only):: | ||
User-defined parameters passed in as part of the query. | ||
|
||
`params['_agg']` (`Map`):: | ||
`Map` with values available from the prior map script. | ||
|
||
*Return* | ||
|
||
`List`, `Map`, `String`, or primitive:: | ||
A value collected for use in a | ||
<<painless-metric-agg-reduce-context, reduce script>>. If no reduce | ||
script is specified, the value is used as part of the result. | ||
|
||
*API* | ||
|
||
The standard <<painless-api-reference, Painless API>> is available. |
32 changes: 32 additions & 0 deletions
32
docs/painless/painless-contexts/painless-metric-agg-init-context.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[[painless-metric-agg-init-context]] | ||
=== Metric Aggregation Initialization Context | ||
|
||
Use a Painless script to | ||
{es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[initialize] | ||
values for use in a scripted metric aggregation. An initialization script is | ||
run prior to document collection once per shard and is optional as part of the | ||
full metric aggregation. | ||
|
||
*Variables* | ||
|
||
`params` (`Map`, read-only):: | ||
User-defined parameters passed in as part of the query. | ||
|
||
`params['_agg']` (`Map`):: | ||
Empty `Map` used to add values for use in a | ||
<<painless-metric-agg-map-context, map script>>. | ||
|
||
*Side Effects* | ||
|
||
`params['_agg']` (`Map`):: | ||
Add values to this `Map` to for use in a map. Additional values must | ||
be of the type `Map`, `List`, `String` or primitive. | ||
|
||
*Return* | ||
|
||
`void`:: | ||
No expected return value. | ||
|
||
*API* | ||
|
||
The standard <<painless-api-reference, Painless API>> is available. |
47 changes: 47 additions & 0 deletions
47
docs/painless/painless-contexts/painless-metric-agg-map-context.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
[[painless-metric-agg-map-context]] | ||
=== Metric Aggregation Map Context | ||
|
||
Use a Painless script to | ||
{es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[map] | ||
values for use in a scripted metric aggregation. A map script is run once per | ||
collected document following an optional | ||
<<painless-metric-agg-init-context, initialization script>> and is required as | ||
part of a full metric aggregation. | ||
|
||
*Variables* | ||
|
||
`params` (`Map`, read-only):: | ||
User-defined parameters passed in as part of the query. | ||
|
||
`params['_agg']` (`Map`):: | ||
`Map` used to add values for processing in a | ||
<<painless-metric-agg-map-context, combine script>> or returned | ||
directly. | ||
|
||
`doc` (`Map`, read-only):: | ||
Contains the fields of the current document where each field is a | ||
`List` of values. | ||
|
||
`_score` (`double` read-only):: | ||
The similarity score of the current document. | ||
|
||
*Side Effects* | ||
|
||
`params['_agg']` (`Map`):: | ||
Use this `Map` to add values for processing in a combine script. | ||
Additional values must be of the type `Map`, `List`, `String` or | ||
primitive. If an initialization script is provided as part the | ||
aggregation then values added from the initialization script are | ||
available as well. If no combine script is specified, values must be | ||
directly stored in `_agg`. If no combine script and no | ||
<<painless-metric-agg-reduce-context, reduce script>> are specified, the | ||
values are used as the result. | ||
|
||
*Return* | ||
|
||
`void`:: | ||
No expected return value. | ||
|
||
*API* | ||
|
||
The standard <<painless-api-reference, Painless API>> is available. |
28 changes: 28 additions & 0 deletions
28
docs/painless/painless-contexts/painless-metric-agg-reduce-context.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[[painless-metric-agg-reduce-context]] | ||
=== Metric Aggregation Reduce Context | ||
|
||
Use a Painless script to | ||
{es_version}/search-aggregations-metrics-scripted-metric-aggregation.html[reduce] | ||
values to produce the result of a scripted metric aggregation. A reduce script | ||
is run once on the coordinating node following a | ||
<<painless-metric-agg-combine-context, combine script>> (or a | ||
<<painless-metric-agg-map-context, map script>> if no combine script is | ||
specified) and is optional as part of a full metric aggregation. | ||
|
||
*Variables* | ||
|
||
`params` (`Map`, read-only):: | ||
User-defined parameters passed in as part of the query. | ||
|
||
`params['_aggs']` (`Map`):: | ||
`Map` with values available from the prior combine script (or a map | ||
script if no combine script is specified). | ||
|
||
*Return* | ||
|
||
`List`, `Map`, `String`, or primitive:: | ||
A value used as the result. | ||
|
||
*API* | ||
|
||
The standard <<painless-api-reference, Painless API>> is available. |
28 changes: 28 additions & 0 deletions
28
docs/painless/painless-contexts/painless-min-should-match-context.asciidoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[[painless-min-should-match-context]] | ||
=== Minimum Should Match Context | ||
|
||
Use a Painless script to specify the | ||
{es_version}/query-dsl-terms-set-query.html[minimum] number of terms that a | ||
specified field needs to match with for a document to be part of the query | ||
results. | ||
|
||
*Variables* | ||
|
||
`params` (`Map`, read-only):: | ||
User-defined parameters passed in as part of the query. | ||
|
||
`params['num_terms']` (`int`, read-only):: | ||
The number of terms specified to match with. | ||
|
||
`doc` (`Map`, read-only):: | ||
Contains the fields of the current document where each field is a | ||
`List` of values. | ||
|
||
*Return* | ||
|
||
`int`:: | ||
The minimum number of terms required to match the current document. | ||
|
||
*API* | ||
|
||
The standard <<painless-api-reference, Painless API>> is available. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a style nit (and not sure I've caught it before), but we've agreed on Sentence style capitalization for headings. It's far from consistent across the docs, but we're trying to move in that direction, especially with new content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.