feat: add api-product-id to ES FTL write and mapping templates#16398
Merged
carlos-andres-osorio merged 1 commit intomasterfrom Apr 15, 2026
Merged
feat: add api-product-id to ES FTL write and mapping templates#16398carlos-andres-osorio merged 1 commit intomasterfrom
carlos-andres-osorio merged 1 commit intomasterfrom
Conversation
Why: Propagates the apiProductId field introduced in reporter-api 2.2.0 into the Elasticsearch document write templates and index mapping, so api-product-id is indexed and filterable in analytics and access logs.
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
wbabyte
approved these changes
Apr 15, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Issue
APIM-13546
Why
API Products analytics requires
api-product-idto be a first-class dimension in Elasticsearch. The field was added to theMetricsandLogmodels ingravitee-reporter-api 2.2.0, but without template changes it would never appear in indexed documents and the index mapping would not declare it as a filterable keyword.What changed
reporter-common) — added a conditionalapi-product-idblock afterapi-nameinv4-metrics.ftlandv4-log.ftlfor all three ES variants (es7x, es8x, es9x). The field is emitted only when non-null, using?j_stringfor safe JSON escaping.reporter-elasticsearch) — declaredapi-product-idas"type": "keyword"afterapi-namein bothindex-template-v4-metrics.ftlandindex-template-v4-log.ftlfor all four variants (es7x, es8x, es9x, opensearch). No explicit"index": true— consistent with all peer ID fields (plan-id,application-id,subscription-id), which are indexed by default.gravitee-reporter-apibumped from 2.1.0 to 2.2.0 in rootpom.xmlto makegetApiProductId()available at compile and test time.given/andexpected/JSON fixtures inreporter-commonto exercise the new field throughElasticsearchFormatterTestandJsonFormatterTest.How to test
mvn test -pl gravitee-apim-reporter/gravitee-apim-reporter-commonAll 99 tests pass. To verify the field appears in ES documents, send a request through a gateway with an API Product attached and inspect the indexed document —
api-product-idshould appear afterapi-name.For manual testing details, see description in #16394
Gotchas / Follow-up
v4-message-log.ftl, message metrics) are out of scope for this story.