Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UnifiedSearch][QueryInput] Simplify api for custom label field representation for query string #184089

Open
dej611 opened this issue May 23, 2024 · 1 comment
Labels
enhancement New value added to drive a business result Feature:Unified search Unified search related tasks Team:Visualizations Visualization editors, elastic-charts and infrastructure triage_needed

Comments

@dej611
Copy link
Contributor

dej611 commented May 23, 2024

Describe the feature:

An API to provide a way to map field names to custom labels for both suggestions and query strings (KQL + Lucene or just KQL).
This API should take care of both map the display value in the suggestion list to the provided one (fallback to the original name if not provided) AND provide to the affected callbacks both the raw and mapped query string (see example below).

Right now it is possible to map field names in the suggestion list with two workarounds:

  • create an ad-hoc dataView to use and pass to the component
  • use the suggestionAbstraction prop who is currently limited to few entities (and not for regular fields).

But the main problem remains the query when provided on onChange/onSubmit callbacks as the consumer has to manipulate it directly in order to generate a valid KQL/Lucene statement.

Describe a specific use case for the feature:

Given a dataView with a list of fields with long names:

very.long.prefix.fieldA
very.long.prefix.fieldB
...

it would be nice to provide a way to customize how these fields are shown or used in the query string/suggestion panel.
For instance, if the consumer would like to show only the last bit of the field name in the suggestion, like:

fieldA
fieldB
...

And use the same custom label for the KQL/Lucene query string too:

fieldA: valueX AND fieldB: valueY

In this case on the onChange/onSubmit callbacks both (or just the mapped one) can be provided as argument:

<QueryInput
  value="fieldA: valueX AND fieldB: valueY"
  ...
  onChange={(query) => {
   // query => "very.long.prefix.fieldA: valueX AND very.long.prefix.fieldB: valueY"
    ...
  }} /> 
@dej611 dej611 added enhancement New value added to drive a business result Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Unified search Unified search related tasks labels May 23, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Unified search Unified search related tasks Team:Visualizations Visualization editors, elastic-charts and infrastructure triage_needed
Projects
None yet
Development

No branches or pull requests

3 participants