Skip to content

Conversation

@seanzatzdev
Copy link
Contributor

This adds the specification for the endpoints for PUT {index}/_sample/config, GET {index}/_sample/config, GET _sample/config , and DELETE {index}/_sample/config

Copy link
Contributor

Copilot AI left a 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.

@seanzatzdev seanzatzdev added the skip-backport This pull request should not be backported label Oct 29, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 29, 2025

Following you can find the validation changes against the target branch for the APIs.

API Status Request Response
indices.delete_sample_configuration 🟠 → 🟢 Missing type → 15/15 Missing type → 15/15
indices.get_all_sample_configuration 🟠 → 🟢 Missing type → 8/8 Missing type → 8/8
indices.get_sample_configuration 🟠 → 🟢 Missing type → 10/10 Missing type → 10/10
indices.put_sample_configuration 🟠 → 🟢 Missing type → 52/52 Missing type → 52/52

You can validate these APIs yourself by using the make validate target.

@seanzatzdev seanzatzdev marked this pull request as ready for review October 29, 2025 16:59
@seanzatzdev seanzatzdev requested a review from masseyke October 29, 2025 16:59
]
path_parts: {
/**
* The name of the index.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or data stream

Copy link
Member

@masseyke masseyke left a 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.

Copy link
Member

@JoshMock JoshMock left a 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
Copy link
Member

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
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-backport This pull request should not be backported specification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants