Skip to content

Filter functions

ytzlax edited this page Jun 26, 2019 · 4 revisions

addSearchChip

This functionality allow you filter the embedded dashboard by search text.

You can search in all fields:

this.iframeElement = document.getElementById('iframe');
this.iframeWindow = (<HTMLIFrameElement>this.iframeElement).contentWindow;

let message={actionType: "addSearchChip", text: "error", index: "logstash-*"}

this.iframeWindow.postMessage(message, '*');

Or you can search in specific field(for example "severity"):

this.iframeElement = document.getElementById('iframe');
this.iframeWindow = (<HTMLIFrameElement>this.iframeElement).contentWindow;

let message={actionType: "addSearchChip", text: "severity:error", index: "logstash-*"}

this.iframeWindow.postMessage(message, '*');

Lets explain the message object:

actionType: In this case "addSearchChip"

text: The text to filter (look at https://www.elastic.co/guide/en/kibana/7.2/kuery-query.html)

index: The elastic index

flushSearchChip

This functionality remove all filters.

this.iframeElement = document.getElementById('iframe');
this.iframeWindow = (<HTMLIFrameElement>this.iframeElement).contentWindow;

let message={actionType: "flushSearchChip"}

this.iframeWindow.postMessage(message, '*');

Lets explain the message object:

actionType: In this case "flushSearchChip"

Clone this wiki locally