Skip to content

Inspector shows incorrect index pattern #187103

Open

Description

Describe the bug:

When using an index filter, the "Index Pattern" that shows up in the inspector is not always accurate.

Steps to reproduce:

  1. Open Discover
  2. In the KQL bar, filter for a specific _index without using wildcards (e.g. _index: logs-2024-06-27)
  3. Open the Inspect panel

Expected behavior:

It would show the "Index Pattern" as logs-2024-06-27. Instead, it shows logs-.

Screenshots (if relevant):

image

Any additional context:

Related: #136407

I believe this regex needs to be adjusted:

parseActiveIndexPatternFromQueryString(queryString: string): string[] {
let m;
const indexPatternSet: Set<string> = new Set();
const regex = /\s?(_index)\s?:\s?[\'\"]?(\w+\-?\*?)[\'\"]?\s?(\w+)?/g;
while ((m = regex.exec(queryString)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
m.forEach((match, groupIndex) => {
if (groupIndex === 2) {
indexPatternSet.add(match);
}
});
}
return [...indexPatternSet];
}

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

Metadata

Assignees

No one assigned

    Labels

    :DataDiscovery/fix-it-weekFeature:InspectorInspector infrastructure and implementationsFeature:SearchQuerying infrastructure in KibanaTeam:DataDiscoveryDiscover App Team (Document Explorer, Saved Search, Surrounding documents, Data, DataViews)bugFixes for quality problems that affect the customer experienceimpact:lowAddressing this issue will have a low level of impact on the quality/strength of our product.loe:smallSmall Level of Effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions