Skip to content

Commit

Permalink
[Vega] Add Filter custom label for kibanaAddFilter (elastic#124498)
Browse files Browse the repository at this point in the history
* [Vega] Add Filter custom label for kibanaAddFilter

* extend documentation

Co-authored-by: Kibana Machine <[email protected]>
Co-authored-by: Joe Reuter <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2022
1 parent 51856f9 commit 164eaf2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/user/dashboard/vega-reference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,9 @@ To keep signal values set `restoreSignalValuesOnRefresh: true` in the Vega confi
/**
* @param {object} query Elastic Query DSL snippet, as used in the query DSL editor
* @param {string} [index] as defined in Kibana, or default if missing
* @param {string} Custom label of the filter shown in the filter bar
*/
kibanaAddFilter(query, index)
kibanaAddFilter(query, index, alias)

/**
* @param {object} query Elastic Query DSL snippet, as used in the query DSL editor
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/vis_types/vega/public/vega_view/vega_base_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,11 @@ export class VegaBaseView {
/**
* @param {object} query Elastic Query DSL snippet, as used in the query DSL editor
* @param {string} [index] as defined in Kibana, or default if missing
* @param {string} Elastic Query DSL's Custom label for kibanaAddFilter, as used in '+ Add Filter'
*/
async addFilterHandler(query, index) {
async addFilterHandler(query, index, alias) {
const indexId = await this.findIndex(index);
const filter = esFilters.buildQueryFilter(query, indexId);
const filter = esFilters.buildQueryFilter(query, indexId, alias);

this._fireEvent({ name: 'applyFilter', data: { filters: [filter] } });
}
Expand Down

0 comments on commit 164eaf2

Please sign in to comment.