Update filter


Hi, I am creating my own special Kibana filter:
function createFilter(field){
_ return{_
_ meta: { _
_ index: 'logstash*', _
_ alias: 'Type filter' _
_ },_
_ query:{_
_ query_string: { query: field}_
_ }_
_ }_
_ }_

I am using queryFilter.addFilters(filter); But I need to update my filter. I am little confused by updateFilter function:
_ source: filterOld,_
_ model: filterNew,_
_ type: 'query'_
_ });_

"source" should be old filter, "model" new one. But when I create filter (with my own function on the top of this text), it doesn't update it or add it.
var filterOld = createFilter("XXX");
var filterNew = createFilter("YYY");

What do I need to do for update? Thanks!

(Stacey Gammon) #2

Taking a look at the code, the updateFilter call creates a new updated filter and returns it. It doesn't modify the filters passed in, and doesn't actually save anything to state. Are you adding the new updated filter to the state once you've created it?


I've found out that I need to call queryFilter.addFilter twice. For old and new filter. But for me it doesn't make any sense to call it also for new filter because I just want to update new one (not "create" one).

(system) #4

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.