-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create GET _cat/transforms API Issue (#53643)
Adds new` _cat/transform` and `_cat/transform/{transform_id}` endpoints.
- Loading branch information
1 parent
de9e44f
commit 110ff6c
Showing
9 changed files
with
481 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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 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 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 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
82 changes: 82 additions & 0 deletions
82
x-pack/plugin/src/test/resources/rest-api-spec/api/transform.cat_transform.json
This file contains 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,82 @@ | ||
{ | ||
"transform.cat_transform":{ | ||
"documentation":{ | ||
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-transform.html" | ||
}, | ||
"stability":"stable", | ||
"url":{ | ||
"paths":[ | ||
{ | ||
"path":"/_cat/transform", | ||
"methods":[ | ||
"GET" | ||
] | ||
}, | ||
{ | ||
"path":"/_cat/transform/{transform_id}", | ||
"methods":[ | ||
"GET" | ||
], | ||
"parts":{ | ||
"transform_id":{ | ||
"type":"string", | ||
"description":"The id of the transform for which to get stats. '_all' or '*' implies all transforms" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"params":{ | ||
"from":{ | ||
"type":"int", | ||
"required":false, | ||
"description":"skips a number of transform configs, defaults to 0" | ||
}, | ||
"size":{ | ||
"type":"int", | ||
"required":false, | ||
"description":"specifies a max number of transforms to get, defaults to 100" | ||
}, | ||
"allow_no_match":{ | ||
"type":"boolean", | ||
"required":false, | ||
"description":"Whether to ignore if a wildcard expression matches no transforms. (This includes `_all` string or when no transforms have been specified)" | ||
}, | ||
"format":{ | ||
"type":"string", | ||
"description":"a short version of the Accept header, e.g. json, yaml" | ||
}, | ||
"h":{ | ||
"type":"list", | ||
"description":"Comma-separated list of column names to display" | ||
}, | ||
"help":{ | ||
"type":"boolean", | ||
"description":"Return help information", | ||
"default":false | ||
}, | ||
"s":{ | ||
"type":"list", | ||
"description":"Comma-separated list of column names or column aliases to sort by" | ||
}, | ||
"time":{ | ||
"type":"enum", | ||
"description":"The unit in which to display time values", | ||
"options":[ | ||
"d (Days)", | ||
"h (Hours)", | ||
"m (Minutes)", | ||
"s (Seconds)", | ||
"ms (Milliseconds)", | ||
"micros (Microseconds)", | ||
"nanos (Nanoseconds)" | ||
] | ||
}, | ||
"v":{ | ||
"type":"boolean", | ||
"description":"Verbose mode. Display column headers", | ||
"default":false | ||
} | ||
} | ||
} | ||
} |
138 changes: 138 additions & 0 deletions
138
x-pack/plugin/src/test/resources/rest-api-spec/test/transform/transforms_cat_apis.yml
This file contains 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,138 @@ | ||
setup: | ||
- skip: | ||
features: headers | ||
- do: | ||
indices.create: | ||
index: airline-data | ||
body: | ||
mappings: | ||
properties: | ||
time: | ||
type: date | ||
airline: | ||
type: keyword | ||
responsetime: | ||
type: float | ||
event_rate: | ||
type: integer | ||
- do: | ||
indices.create: | ||
index: airline-data-other | ||
body: | ||
mappings: | ||
properties: | ||
time: | ||
type: date | ||
airline: | ||
type: keyword | ||
responsetime: | ||
type: float | ||
event_rate: | ||
type: integer | ||
- do: | ||
transform.put_transform: | ||
transform_id: "airline-transform-stats" | ||
body: > | ||
{ | ||
"source": { "index": "airline-data" }, | ||
"dest": { "index": "airline-data-by-airline" }, | ||
"pivot": { | ||
"group_by": { "airline": {"terms": {"field": "airline"}}}, | ||
"aggs": {"avg_response": {"avg": {"field": "responsetime"}}} | ||
} | ||
} | ||
--- | ||
teardown: | ||
- do: | ||
transform.delete_transform: | ||
transform_id: "airline-transform-stats" | ||
|
||
--- | ||
"Test cat transform stats hiding headers": | ||
- do: | ||
transform.cat_transform: | ||
transform_id: "airline-transform-stats" | ||
- match: | ||
$body: | | ||
/^ #id \s+ create_time \s+ version \s+ source_index \s+ dest_index \s+ pipeline \s+ transform_type \s+ frequency \s+ max_page_search_size \s+ state \n | ||
(airline\-transform\-stats \s+ [^\s]+ \s+ [^\s]+ \s+ airline-data \s+ airline-data-by-airline \s+ \s+ batch \s+ 1m \s+ 500 \s+ STOPPED \n)+ $/ | ||
--- | ||
"Test cat transform stats with column selection": | ||
- do: | ||
transform.cat_transform: | ||
transform_id: "airline-transform-stats" | ||
v: true | ||
h: id,version,source_index,dest_index,search_total,index_total,dt,cdtea,indexed_documents_exp_avg | ||
- match: | ||
$body: | | ||
/^ id \s+ version \s+ source_index \s+ dest_index \s+ search_total \s+ index_total \s+ dt \s+ cdtea \s+ indexed_documents_exp_avg \n | ||
(airline\-transform-stats \s+ [^\s]+ \s+ airline-data \s+ airline-data-by-airline \s+ 0 \s+ 0 \s+ 0 \s+ 0.0 \s+ 0.0 \n)+ $/ | ||
--- | ||
"Test cat transform stats with batch transform": | ||
- do: | ||
transform.put_transform: | ||
transform_id: "airline-transform-batch" | ||
body: > | ||
{ | ||
"source": { | ||
"index": ["airline-data", "airline-data-other"], | ||
"query": {"bool":{"filter":{"term":{"airline":"foo"}}}} | ||
}, | ||
"dest": { "index": "airline-data-by-airline-batch" }, | ||
"pivot": { | ||
"group_by": { "airline": {"terms": {"field": "airline"}}}, | ||
"aggs": {"avg_response": {"avg": {"field": "responsetime"}}} | ||
}, | ||
"description": "description" | ||
} | ||
- do: | ||
transform.cat_transform: | ||
transform_id: "airline-transform-batch" | ||
v: true | ||
- match: | ||
$body: | | ||
/^ id \s+ create_time \s+ version \s+ source_index \s+ dest_index \s+ pipeline \s+ description \s+ transform_type \s+ frequency \s+ max_page_search_size \s+ state \n | ||
(airline\-transform\-batch \s+ [^\s]+ \s+ [^\s]+ \s+ airline-data,airline-data-other \s+ airline-data-by-airline-batch \s+ \s+ description \s+ batch \s+ 1m \s+ 500 \s+ STOPPED \n)+ $/ | ||
- do: | ||
transform.delete_transform: | ||
transform_id: "airline-transform-batch" | ||
|
||
--- | ||
"Test cat transform stats with continuous transform": | ||
- do: | ||
transform.put_transform: | ||
transform_id: "airline-transform-continuous" | ||
body: > | ||
{ | ||
"source": { | ||
"index": ["airline-data", "airline-data-other"], | ||
"query": {"bool":{"filter":{"term":{"airline":"foo"}}}} | ||
}, | ||
"dest": { "index": "airline-data-by-airline-continuous" }, | ||
"frequency": "10s", | ||
"pivot": { | ||
"group_by": { "airline": {"terms": {"field": "airline"}}}, | ||
"aggs": {"avg_response": {"avg": {"field": "responsetime"}}} | ||
}, | ||
"description": "description", | ||
"sync": { | ||
"time": { | ||
"field": "time" | ||
} | ||
} | ||
} | ||
- do: | ||
transform.cat_transform: | ||
transform_id: "airline-transform-continuous" | ||
v: true | ||
- match: | ||
$body: | | ||
/^ id \s+ create_time \s+ version \s+ source_index \s+ dest_index \s+ pipeline \s+ description \s+ transform_type \s+ frequency \s+ max_page_search_size \s+ state \n | ||
(airline\-transform\-continuous \s+ [^\s]+ \s+ [^\s]+ \s+ airline-data,airline-data-other \s+ airline-data-by-airline-continuous \s+ \s+ description \s+ continuous \s+ 10s \s+ 500 \s+ STOPPED \n)+ $/ | ||
- do: | ||
transform.delete_transform: | ||
transform_id: "airline-transform-continuous" |
This file contains 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
Oops, something went wrong.