This repository was archived by the owner on Nov 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Rewrite index names on ingest #1448
Merged
Merged
Conversation
This file contains hidden or 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
Contributor
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 introduces a configurable index name rewriting feature for the ingest processor, allowing users to apply ordered regex-based rewrite rules before routing data.
- Injects a new
IndexNameRewriterintoIngestProcessorand wires it through bulk write logic - Implements
IndexNameRewriterwith no‐op and regex‐based rewriters - Updates V2 config translation and validation to support ordered rewrite rules, and adds both unit and integration tests
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| platform/ingest/processor.go | Added IndexNameRewriter field, getter, and constructor injection |
| platform/ingest/index_name_rewriter.go | New regex‐based and no‐op rewriter implementations |
| platform/functionality/bulk/bulk.go | Extended SplitBulk and Write to accept and apply rewriter |
| platform/functionality/bulk/bulk_test.go | Updated tests to pass a NoOpIndexNameRewriter |
| platform/config/config.go | Added legacy config slice for rewrite rules |
| platform/config/config_v2.go | Added map field, validation for rewrite rules |
| platform/config/config_v2_util.go | Translated and ordered V2 rewrite rules into legacy form |
| platform/config/config_v2_test.go | Added unit test for V2 config translation of rules |
| platform/config/test_configs/index_name_rewrite_rules.yaml | New test YAML for rewrite rules |
| ci/it/configs/quesma-index-name-rewrite.yml.template | Integration test config template with rewrite rules |
| ci/it/testcases/test_index_name_rewrite.go | New IT testcase verifying rewrite behavior |
| ci/it/integration_test.go | Hooked up the new rewrite integration test |
Comments suppressed due to low confidence (3)
platform/ingest/index_name_rewriter.go:12
- [nitpick] Add a Go doc comment above the
IndexNameRewriterinterface to explain its purpose, e.g.// IndexNameRewriter allows rewriting of Elasticsearch index names on ingest.
type IndexNameRewriter interface {
platform/ingest/index_name_rewriter.go:67
- There are no direct unit tests for
indexNameRegexpRewriter.RewriteIndex. Adding table‐driven tests for matching and non‐matching patterns would ensure the logic is exercised.
func (i *indexNameRegexpRewriter) RewriteIndex(indexName string) string {
platform/functionality/bulk/bulk.go:121
- The
ingestpackage isn’t imported here, leading to an undefinedingest.IndexNameRewritertype. Add"github.com/QuesmaOrg/quesma/platform/ingest"to the import block.
func SplitBulk(ctx context.Context, defaultIndex *string, bulk types.NDJSON, maxBulkSize int, tableResolver table_resolver.TableResolver, rewriter ingest.IndexNameRewriter) ([]BulkItem, map[string][]BulkRequestEntry, []byte, []BulkRequestEntry, error) {
jakozaur
approved these changes
Jun 6, 2025
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 11, 2025
Fixes panic introduced here (#1448).
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds options to rewrite index names on ingest. It's beneficial if we want all
dailyindices into single index.It is configured as a list of rules. These rules are applied in order (sorted names).
fromcontains a matching regexptopart contains a match group nameRewriting is done at a very early stage of processing.
Here is a example config:
It will rewrite
logs-2023.01intologs.