# Filter question

**URL:** <https://discuss.elastic.co/t/filter-question/16693>\
**Category:** Elasticsearch\
**Created:** [March 29, 2014, 1:21pm UTC](https://discuss.elastic.co/t/filter-question/16693 "2014-03-29T13:21:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![efeerdogru](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/efeerdogru/32/17267_2.png) [@efeerdogru](https://discuss.elastic.co/u/efeerdogru)\
**Post date:** [March 29, 2014, 1:21pm UTC](https://discuss.elastic.co/t/filter-question/16693/1 "2014-03-29T13:21:33Z")

</div>

Hi all,

I have an index on ES and I'm filtering the results. That's ok. But  
sometimes business rules change.

Let's say, I need a field called "IsVisible" and I want to filter results  
(IsVisible, true) in queries.

For ex, IsVisible will be true when Field1 is stg, Field2 is stg and Field3  
is stg. When business rule changed, IsVisible must be true for ex Field1  
and Field4 is stg.

I can not store the field "IsVisible" in ES because when business rule  
changed I have to reindex whole data from database and it takes hours.

If you say, change the filter expressions in source code, I have to change  
multiple files and it means lots of test.

Is there someting, I don't know how to say but, an expression or stg that,  
I want to store the business rule into ES by not changing index structure  
or refreshing data, I want to filter "IsVisible" field but when I change  
the field (or whatever) query results will be changed without updating any  
code or data refresh.

I hope I can explain what I need.

Tnx.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/79a0009e-6487-4215-8a79-df2ef2211b27%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/79a0009e-6487-4215-8a79-df2ef2211b27%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [March 31, 2014, 8:04pm UTC](https://discuss.elastic.co/t/filter-question/16693/2 "2014-03-31T20:04:44Z")

</div>

One way is to define an alias (and have your code query this alias) with a  
filter behind it. Then you can just change the alias filter definition  
dynamically as needed.

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html#filtered](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html#filtered)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/dcefc4ba-a959-45e7-9d25-ebf166005a47%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/dcefc4ba-a959-45e7-9d25-ebf166005a47%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:39am UTC](https://discuss.elastic.co/t/filter-question/16693/3 "2017-07-06T01:39:15Z")

</div>

Closed on July 6, 2017, 1:39am UTC


