apache / apache/shenyu

[BUG] Elasticsearch indices are created without an index template / mapping

Open
#6,561 1 comment 0 reactions 0 assignees View on GitHub
plugin: logging-elasticSearch priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
No index template is ever installed. Each new daily index is auto-mapped from the first ingested document. Most concretely, `ShenyuRequestLog.timeLocal` is a `String` formatted `yyyy-MM-dd HH:mm:ss.SSS` (space separator), which does not match any of ES's default `dynamic_date_formats`, so it is mapped as `text`/`keyword` rather than `date` — breaking time-range queries and date aggregations on the log store.

## Location
```
shenyu-plugin-logging-elasticsearch/.../client/ElasticSearchLogCollectClient.java:149-155
```

## Impact
Time-range queries and date aggregations on the log store are broken because `timeLocal` and numeric fields are mis-mapped.

## Suggested fix
Install an index template (or explicit mappings at `createIndex`) declaring `timeLocal` as `date` with the `yyyy-MM-dd HH:mm:ss.SSS` format and the numeric fields as `long`/`integer`.

## Related existing issue(s)
#6148 (closed) was about multiple-timestamp indices failing writes; this is the underlying missing-template root cause, distinct.

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

The relevant entry point is shenyu-plugin-logging-elasticsearch/.../client/ElasticSearchLogCollectClient.java:149-155; read the index-creation path and inspect how ShenyuRequestLog fields are currently inferred. Verify that the installed template or createIndex mappings declare timeLocal with the stated date format and numeric fields with integer/long types, then confirm time-range queries and date aggregations work.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, java
Domain
databases, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.