# Problem in adding two range facets with the same options names but for different filters

**URL:** https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202
**Category:** Elastic Search
**Created:** [October 20, 2021, 2:03pm UTC](https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202 "2021-10-20T14:03:08Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![AhmedTohamy01](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@AhmedTohamy01](https://discuss.elastic.co/u/AhmedTohamy01)
#### Post date: [October 20, 2021, 2:03pm UTC](https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202/1 "2021-10-20T14:03:08Z")

</div>

Hi,

I'm trying to add two range facets, the options in both of them are the same but it's for different filters.

something like this:

```auto
const installs = {

  type: 'range',

  ranges: [

    { from: 0, to: 101, name: '<= 100' },

    { from: 100, to: 501, name: '100 - 500' },

    { from: 500, to: 1001, name: '500 - 1000' },

    { from: 1001, to: 5001, name: '5k' },

    { from: 5001, to: 10001, name: '10k' },

    { from: 10001, to: 50001, name: '50k' },

    { from: 50001, to: 100001, name: '100k' },

    { from: 100001, to: 500001, name: '500k' },

    { from: 500001, to: 1000001, name: '1M' },

    { from: 1000001, to: 10000001, name: '10M' },

    { from: 10000001, to: 100000001, name: '100M' },

    { from: 100000001, name: '> 100M' },

  ],
}

const reviews = {

  type: 'range',

  ranges: [

    { from: 0, to: 101, name: '<= 100' },

    { from: 100, to: 501, name: '100 - 500' },

    { from: 500, to: 1001, name: '500 - 1000' },

    { from: 1001, to: 5001, name: '5k' },

    { from: 5001, to: 10001, name: '10k' },

    { from: 10001, to: 50001, name: '50k' },

    { from: 50001, to: 100001, name: '100k' },

    { from: 100001, to: 500001, name: '500k' },

    { from: 500001, to: 1000001, name: '1M' },

    { from: 1000001, to: 10000001, name: '10M' },

    { from: 10000001, to: 100000001, name: '100M' },

    { from: 100000001, name: '> 100M' },

  ],
}

```

And it will look like this in the browser:

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/f/5f6ffa0d4453d4bb33366dfc42e0b012de780342.png)

The problem is that when I check one of the check-boxes, let's say the option named "\<= 100" in "installs" facet, the other "\<= 100" checkbox in "reviews" facet is also get selected.

If i changed the "name" value in the above code to different values for each facet it works fine (for example in installs facet it will be "\<= 100" & in reviews facet it will be "\<= 100 reviews")

Is there is any solution for this? can't we simply add 2 range filters with the same options names ?

---

<div class="post-metadata">

### Author: ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)
#### Post date: [October 20, 2021, 2:45pm UTC](https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202/2 "2021-10-20T14:45:37Z")

</div>

Can you show me more code? Where are you using these 2 variables?

---

<div class="post-metadata">

### Author: ![AhmedTohamy01](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@AhmedTohamy01](https://discuss.elastic.co/u/AhmedTohamy01)
#### Post date: [October 20, 2021, 3:08pm UTC](https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202/3 "2021-10-20T15:08:45Z")

</div>

@JasonStoltz

I'm using these 2 variables in the Search Configs, like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/c/ac330dc6d5fef468d6db399a63a224dbd415a029.png)

And the installs facet code like the following:

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/4/545b3138dfa623a1be52aa6e556ec9e7ead0a2ef.png)

And reviews facet code like the following:

![image](https://us1.discourse-cdn.com/elastic/original/3X/c/d/cd625d86518f82ecc6c4b6cefefb1e6d857027c9.png)

And Thank you for the fast reply 🙂

---

<div class="post-metadata">

### Author: ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)
#### Post date: [October 21, 2021, 1:33pm UTC](https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202/4 "2021-10-21T13:33:04Z")

</div>

Try turning on [Debugging](https://github.com/elastic/search-ui/blob/master/ADVANCED.md#debugging). See what gets printed to the console when you select a facet value.

You should see something like:

```auto
Search UI: Action setFilter {Action Parameters}

```

The action parameters should contain the correct field name and value corresponding to the facet box you are using.

---

<div class="post-metadata">

### Author: ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)
#### Post date: [October 21, 2021, 1:37pm UTC](https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202/5 "2021-10-21T13:37:01Z")

</div>

FWIW, I set up a similar scenario here with no problems: [search-ui-national-parks-example (forked) - CodeSandbox](https://codesandbox.io/s/search-ui-national-parks-example-forked-vqw9n?file=/src/App.js). Specifically, with the square\_km and acres fields faces.

See if you can reproduce your issue in that Sandbox!

---

<div class="post-metadata">

### Author: ![AhmedTohamy01](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@AhmedTohamy01](https://discuss.elastic.co/u/AhmedTohamy01)
#### Post date: [October 22, 2021, 7:42pm UTC](https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202/6 "2021-10-22T19:42:44Z")

</div>

@JasonStoltz

Thank you man. Your Sandbox solution was very helpful in solving my issue, It's solved now.

Much appreciated 🙂

---

<div class="post-metadata">

### Author: ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)
#### Post date: [October 25, 2021, 1:05pm UTC](https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202/7 "2021-10-25T13:05:52Z")

</div>

Glad it helped!

---

<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: [November 4, 2022, 8:32am UTC](https://discuss.elastic.co/t/problem-in-adding-two-range-facets-with-the-same-options-names-but-for-different-filters/287202/8 "2022-11-04T08:32:44Z")

</div>


