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

[Lens] Pass the uiSettings default language to filters aggregation #77012

Closed
mbondyra opened this issue Sep 9, 2020 · 5 comments
Closed

[Lens] Pass the uiSettings default language to filters aggregation #77012

mbondyra opened this issue Sep 9, 2020 · 5 comments
Labels
Feature:Lens good first issue low hanging fruit Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture
Projects

Comments

@mbondyra
Copy link
Contributor

mbondyra commented Sep 9, 2020

Describe the feature:
Can be done after merging #75635
Right now we use 'kuery' as a default language in filters aggregation, but in the future we want this setting to come from uiSettings. The implementation details can be found below (by Joe):

It looks like there are three cases where the default query is required: When adding a new filter using the add button in the UI (which has access to data), when initializing an empty filters array (in buildColumn) and when writing the esaggs config. The one in buildColumn could be omitted because it will be caught by the logic in toEsAggsConfig and in the UI anyway.

To solve it cleanly we could extend toEsAggsConfig to also pass in data. This is a change scoped in the index pattern datasource. To do so,

export function toExpression(state: IndexPatternPrivateState, layerId: string) {

has to be replaced by a generator function to pass in the reference and keep it in a function closure:

export function getToExpression(data: DataStart) {
 return function toExpression(state: IndexPatternPrivateState, layerId: string) {
  if (state.layers[layerId]) {
    return getExpressionForLayer(
      state.indexPatterns[state.layers[layerId].indexPatternId],
      state.layers[layerId].columns,
      state.layers[layerId].columnOrder,
      data
    );
  }

  return null;
}
}

Then it can be passed through like this:

export function toExpression(state: IndexPatternPrivateState, layerId: string) {

return operationDefinitionMap[column.operationType].toEsAggsConfig(

filters: validFilters?.length > 0 ? validFilters : [getDefaultFilter()],

For buildColumn it's pretty similar - we call it in the dimension panel and popover editor (which have access to data already, so that's easy) and in suggestions. For suggestions, we would need to do the same thing as described above for toEsAggsConfig.

@mbondyra mbondyra added Feature:Lens good first issue low hanging fruit Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture labels Sep 9, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@mbondyra mbondyra added this to Long-term goals in Lens via automation Sep 9, 2020
@PavithraCP
Copy link
Contributor

Hello, I'm a new contributor to kibana. I'm interested in picking this up, is this available?

@flash1293
Copy link
Contributor

Hi @PavithraCP

First, thanks for looking into contributing to Kibana - contributors are always welcome 💚

This issue is indeed up for grabs, but a word of warning - you will have to make changes in quite some places. So while not terribly complicated, this issue can become a bit larger. If you want to start with something with something smaller within Lens, I can recommend #72243 - that shouldn't require more than a couple lines.

If you have interest working on one of those issues, just drop a note, and we can assign you to it. If you will drop it again, please make sure to leave another note, so we can unassign you from that issue again.

@PavithraCP
Copy link
Contributor

Thanks @flash1293 , as per your suggestion I'll start with #72243, I've dropped a note there too :)

@ghudgins
Copy link

closing this for lens - KQL is the default and hasn't honored this setting and we haven't received any requests for it. can revisit if something changes later

Lens automation moved this from Long-term goals to Done Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens good first issue low hanging fruit Team:Visualizations Visualization editors, elastic-charts and infrastructure technical debt Improvement of the software architecture and operational architecture
Projects
No open projects
Lens
  
Done
Development

No branches or pull requests

5 participants