Filter question


(Efe Erdoğru) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/79a0009e-6487-4215-8a79-df2ef2211b27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #2

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

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/dcefc4ba-a959-45e7-9d25-ebf166005a47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3