- 
                Notifications
    You must be signed in to change notification settings 
- Fork 116
Add sampling config specifications #5573
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds comprehensive API specifications for sampling configuration management in Elasticsearch. It introduces four new endpoints for creating, retrieving, and deleting sampling configurations for indices, enabling users to configure random sampling of documents with parameters like sample rate, size limits, retention periods, and conditional filtering.
Key changes:
- Added PUT endpoint for creating/updating sampling configurations with configurable rate, max samples, size limits, TTL, and conditional scripts
- Added GET endpoints for retrieving single and all index sampling configurations
- Added DELETE endpoint for removing sampling configurations
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description | 
|---|---|
| IndicesPutSampleConfigurationRequest.ts | Defines request structure for creating/updating sampling configs with validation constraints | 
| IndicesPutSampleConfigurationResponse.ts | Response type returning acknowledgment for PUT operations | 
| IndicesGetSampleConfigurationRequest.ts | Request structure for retrieving single index sampling config | 
| IndicesGetSampleConfigurationResponse.ts | Response containing index name and configuration (nullable) | 
| IndicesGetAllSampleConfigurationRequest.ts | Request structure for retrieving all sampling configs | 
| IndicesGetAllSampleConfigurationResponse.ts | Response containing array of index configurations | 
| IndexSamplingConfiguration.ts | Type definition pairing index name with its configuration | 
| IndicesDeleteSampleConfigurationRequest.ts | Request structure for deleting sampling config | 
| IndicesDeleteSampleConfigurationResponse.ts | Response returning acknowledgment for DELETE operations | 
| SampleConfigurationOutput.ts | Core type defining sampling configuration structure with both human-readable and raw numeric fields | 
| Request/response example YAML files | Example payloads demonstrating API usage | 
| types.ts | Generated TypeScript interface definitions | 
| schema.json | Generated JSON schema with API metadata and type definitions | 
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
# Conflicts: # output/schema/schema.json
6700105    to
    2a3f2b7      
    Compare
  
    | Following you can find the validation changes against the target branch for the APIs. 
 You can validate these APIs yourself by using the  | 
| ] | ||
| path_parts: { | ||
| /** | ||
| * The name of the index. | 
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.
or data stream
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.
I left one very minor comment, but looks good to me.
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.
A couple (hopefully simple) questions, but this is great overall.
| * The fraction of documents to sample. Must be greater than 0 and less than or equal to 1. | ||
| * Can be specified as a number or a string. | ||
| */ | ||
| rate: double | string | 
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.
If the string in this union is just a string representation of a double, you should use the Stringified<double> utility type instead.
| /** | ||
| * An optional condition script that sampled documents must satisfy. | ||
| */ | ||
| if?: string | 
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.
What is the format of these if strings? Painless?
This adds the specification for the endpoints for
PUT {index}/_sample/config,GET {index}/_sample/config,GET _sample/config, andDELETE {index}/_sample/config