Skip to content

[7.9][DOCS] Amends Painless in group_by transform example #67350

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 1 commit into from
Jan 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 48 additions & 21 deletions docs/reference/transform/painless-examples.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ POST _transform/_preview
}
},
"aggregations": { <3>
"all": {
"value_count": {
"field": "response.keyword"
}
},
"200": {
"filter": {
"term": {
Expand Down Expand Up @@ -227,50 +232,72 @@ documents, then iterates through the values. If an `agent` field contains
contains "Firefox". Finally, in every other case, the value of the field is
returned.
<3> The aggregations object contains filters that narrow down the results to
documents that contains `200`, `404`, or `503` values in the `response` field.
documents that contains `200`, `404`, or `503` values in the `response` field
and an aggregation that counts responses for each agent.
<4> Specifies the destination index of the {transform}.


The API returns the following result:

[source,js]
--------------------------------------------------
{
"preview" : [
{
"all" : 4010,
"agent" : "explorer",
"200" : 3674,
"404" : 210,
"503" : 126
},
{
"all" : 5362,
"agent" : "firefox",
"200" : 4931,
"404" : 259,
"503" : 172
},
{
"agent" : "internet explorer",
"200" : 3674,
"404" : 210,
"503" : 126
},
{
"all" : 4702,
"agent" : "safari",
"200" : 4227,
"404" : 332,
"503" : 143
}
],
"mappings" : {
"properties" : {
"200" : {
"type" : "long"
},
"agent" : {
"type" : "keyword"
},
"404" : {
"type" : "long"
"generated_dest_index" : {
"mappings" : {
"_meta" : {
"_transform" : {
"transform" : "transform-preview",
"version" : {
"created" : "7.9.3"
},
"creation_date_in_millis" : 1610454866455
},
"created_by" : "transform"
},
"503" : {
"type" : "long"
"properties" : {
"all" : {
"type" : "long"
},
"200" : {
"type" : "long"
},
"404" : {
"type" : "long"
},
"503" : {
"type" : "long"
}
}
}
},
"settings" : {
"index" : {
"number_of_shards" : "1",
"auto_expand_replicas" : "0-1"
}
},
"aliases" : { }
}
}
--------------------------------------------------
Expand Down