# Custom background filter

**URL:** https://discuss.elastic.co/t/custom-background-filter/136553
**Category:** Kibana
**Created:** [June 19, 2018, 6:23pm UTC](https://discuss.elastic.co/t/custom-background-filter/136553 "2018-06-19T18:23:15Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Red\_Thomas](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Red\_Thomas](https://discuss.elastic.co/u/Red_Thomas)
#### Post date: [June 19, 2018, 6:23pm UTC](https://discuss.elastic.co/t/custom-background-filter/136553/1 "2018-06-19T18:23:16Z")

</div>

I'm trying to create a visualization using significant terms and I'd like to customize the background filter. Anyone have an idea on how to do so easily in Kibana?

Basically, I'd like to have a query where the foreground set is last hour, and background set is the same hour on the day of the week for the last four weeks.

The ES query is pretty straight forward. Getting it to work in Kibana is what's giving me some problems.

Thanks!

---

<div class="post-metadata">

### Author: ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)
#### Post date: [June 19, 2018, 6:26pm UTC](https://discuss.elastic.co/t/custom-background-filter/136553/2 "2018-06-19T18:26:28Z")

</div>

Hi,

Its not possible right now. Can you please log a feature request here and please let us know which visualization you want this to work on? [https://github.com/elastic/kibana](https://github.com/elastic/kibana)

Thanks,  
Bhavya

---

<div class="post-metadata">

### Author: ![Red\_Thomas](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Red\_Thomas](https://discuss.elastic.co/u/Red_Thomas)
#### Post date: [June 19, 2018, 6:29pm UTC](https://discuss.elastic.co/t/custom-background-filter/136553/3 "2018-06-19T18:29:04Z")

</div>

Wilco. Seems like adjusting the background set ought to be available for any of them, though. Anytime you use significant terms, there's a chance you're going to want to adjust the background set. Especially when you're looking for significance when comparing like-with-like.

Thanks!

---

<div class="post-metadata">

### Author: ![Red\_Thomas](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Red\_Thomas](https://discuss.elastic.co/u/Red_Thomas)
#### Post date: [June 19, 2018, 6:36pm UTC](https://discuss.elastic.co/t/custom-background-filter/136553/4 "2018-06-19T18:36:04Z")

</div>

Done, and appreciated.

Thanks for the quick answer.

> <https://github.com/elastic/kibana/issues/20047>

---

<div class="post-metadata">

### Author: ![Red\_Thomas](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@Red\_Thomas](https://discuss.elastic.co/u/Red_Thomas)
#### Post date: [June 25, 2018, 1:58pm UTC](https://discuss.elastic.co/t/custom-background-filter/136553/5 "2018-06-25T13:58:59Z")

</div>

I wanted to update this with an answer. It turns out this is possible using the JSON Input under the advanced options in the query. I'd tried and turns out it wasn't working because I flubbed the custom query.

Here's a working example:

> **Query**
>
> {  
> "background\_filter" : {  
> "bool" : {  
> "should" : [  
> {  
> "range": {  
> "@timestamp": {  
> "gte": "now-1h/h",  
> "lte": "now/h"  
> }  
> }  
> },  
> {  
> "range" : {  
> "@timestamp" : {  
> "gte" : "now-25h/h",  
> "lte" : "now-24h/h"  
> }  
> }  
> },  
> {  
> "range" : {  
> "@timestamp" : {  
> "gte" : "now-49h/h",  
> "lte" : "now-48h/h"  
> }  
> }  
> },  
> {  
> "range" : {  
> "@timestamp" : {  
> "gte" : "now-73h/h",  
> "lte" : "now-72h/h"  
> }  
> }  
> },  
> {  
> "range" : {  
> "@timestamp" : {  
> "gte" : "now-97h/h",  
> "lte" : "now-96h/h"  
> }  
> }  
> }  
> ]  
> }  
> }  
> }

I setup the visualization using significant terms to look at DNS queries and limited the query to the last hour. The background filter then combines the last hour and the same hour of the same day of the week for the last four weeks.

This results in significant terms that account for normal fluctuation in user activity.

Compliments to Tim Roes for his answer to my feature request on the github page, which directly helped me to get this sorted.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 23, 2018, 1:59pm UTC](https://discuss.elastic.co/t/custom-background-filter/136553/6 "2018-07-23T13:59:01Z")

</div>

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