-
Couldn't load subscription status.
- Fork 115
Adding specification for the get random sample and get random sample stats APIs #5528
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
Changes from 14 commits
53b2e21
f8329db
fe9a064
644b9f8
c1bdda0
7bcc8c1
d9f56b4
5acde95
831b8e3
86b5587
01cb644
4193da6
94099ef
1df580b
8feb83c
7f95879
bdc738e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,4 +7,4 @@ | |
| "@stoplight/spectral-cli": "^6.14.2" | ||
| }, | ||
| "version": "overlay" | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { RequestBase } from '@_types/Base' | ||
| import { IndexName } from '@_types/common' | ||
|
|
||
| /** | ||
| * Request for a random sample of raw documents ingested into the given index or data stream. | ||
| * | ||
| * @rest_spec_name indices.get_sample | ||
| * @availability serverless visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental | ||
|
||
| * @doc_id random_sample | ||
| * @doc_tag random_sample | ||
| */ | ||
| export interface Request extends RequestBase { | ||
| urls: [ | ||
| { | ||
| path: '/{index}/_sample' | ||
| methods: ['GET'] | ||
| } | ||
| ] | ||
| path_parts: { | ||
| /** | ||
| * Single index or data stream name. Wildcards are not supported. | ||
| */ | ||
| index: IndexName | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { RawDocument } from './_types/RawDocument' | ||
|
|
||
| /** | ||
| * Response type for the get_random_samples API. | ||
| * It reuses the standard SearchResponse structure. | ||
| */ | ||
| export class Response { | ||
| body: { sample: RawDocument[] } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { PropertyName } from '@_types/common' | ||
| import { Property } from '@_types/mapping/Property' | ||
| import { Dictionary } from '@spec_utils/Dictionary' | ||
|
|
||
| export class RawDocument { | ||
| /** | ||
| * Name of the index for this raw document. | ||
| */ | ||
| index: string | ||
| /** | ||
| * The original raw source. | ||
| */ | ||
| source: Dictionary<PropertyName, Property> | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # summary: '' | ||
| description: A successful response for retrieving the random sample for an index or data stream. | ||
| # type: response | ||
| # response_code: 200 | ||
| value: |- | ||
| { | ||
| "sample": [ | ||
| { | ||
| "index": "logs", | ||
| "source": { | ||
| "@timestamp": "2099-11-15T13:12:00", | ||
| "message": "Node 0 message", | ||
| "user": { | ||
| "id": "kimchy" | ||
| }, | ||
| "network": { | ||
| "name": "Guest" | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "index": "logs", | ||
| "source": { | ||
| "@timestamp": "2079-11-15T13:12:00", | ||
| "message": "Node 1 message", | ||
| "user": { | ||
| "id": "kimchy" | ||
| }, | ||
| "network": { | ||
| "name": "Guest" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| method_request: GET /my-index-000001/_sample |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { RequestBase } from '@_types/Base' | ||
| import { IndexName } from '@_types/common' | ||
|
|
||
| /** | ||
| * Request stats for a random sample of raw documents ingested into the given index or data stream. | ||
| * | ||
| * @rest_spec_name indices.get_sample_stats | ||
| * @availability serverless visibility=feature_flag feature_flag=random_sampling since=9.3.0 stability=experimental | ||
| * @doc_id random_sample | ||
| * @doc_tag random_sample | ||
| */ | ||
| export interface Request extends RequestBase { | ||
| urls: [ | ||
| { | ||
| path: '/{index}/_sample/stats' | ||
| methods: ['GET'] | ||
| } | ||
| ] | ||
| path_parts: { | ||
| /** | ||
| * Single index or data stream name. Wildcards are not supported. | ||
| */ | ||
| index: IndexName | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { long } from '@_types/Numeric' | ||
| import { Duration, DurationValue, UnitMillis } from '@_types/Time' | ||
|
|
||
| /** | ||
| * Response type for the get_random_samples API. | ||
| * It reuses the standard SearchResponse structure. | ||
| */ | ||
| export class Response { | ||
| body: { | ||
| potential_samples: long | ||
| samples_rejected_for_max_samples_exceeded: long | ||
| samples_rejected_for_condition: long | ||
| samples_rejected_for_rate: long | ||
| samples_rejected_for_exception: long | ||
| samples_rejected_for_size: long | ||
| samples_accepted: long | ||
| time_sampling?: Duration | ||
| time_sampling_millis: DurationValue<UnitMillis> | ||
| time_evaluating_condition?: Duration | ||
| time_evaluating_condition_millis: DurationValue<UnitMillis> | ||
| time_compiling_condition?: Duration | ||
| time_compiling_condition_millis: DurationValue<UnitMillis> | ||
| last_exception?: string | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # summary: '' | ||
| description: A successful response for retrieving the random sample stats for an index or data stream. | ||
| # type: response | ||
| # response_code: 200 | ||
| value: |- | ||
| { | ||
| "potential_samples": 2, | ||
| "samples_rejected_for_max_samples_exceeded": 0, | ||
| "samples_rejected_for_condition": 0, | ||
| "samples_rejected_for_rate": 0, | ||
| "samples_rejected_for_exception": 0, | ||
| "samples_rejected_for_size": 0, | ||
| "samples_accepted": 2, | ||
| "time_sampling": "415.7micros", | ||
| "time_sampling_millis": 0, | ||
| "time_evaluating_condition": "185.9micros", | ||
| "time_evaluating_condition_millis": 0, | ||
| "time_compiling_condition": "98.4micros", | ||
| "time_compiling_condition_millis": 0 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| method_request: GET /my-index-000001/_sample/stats |
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.
is this part generated? seems like this isnt a valid url
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.
Yeah sorry, I copied that pattern from an old PR. It looks like the URLs are different now, so I've made it look more like other ones. Hopefully someone from the docs team can chime in if that's wrong.