Two options come to mind:

1) Filtered aliases:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-aliases.html#filtered

2) Search template and Template queries:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-template-query.html

The last feature is new and I have yet to try it out.

Cheers,

Ivan




On Thu, May 29, 2014 at 11:09 AM, W Shaib <[email protected]> wrote:

> I am trying to set up document-level security for my index. The documents
> have fields which will be filtered on to enforce access permissions.
>
> My question is: given a query, is it possible to set things up so that ES
> will invoke a custom script filter on *every* clause in said query without
> having to munge the query myself to insert the filter explicitly?
>
> For example, if a query is:
>
> filtered: {
>     query: {
>        term: { foo: "bar" }
>     },
>     filter: {
>        has_parent: {
>           type: "some_type",
>           query: {
>              term: { blah: "xyz" }
>           }
>       }
>    }
> }
>
> then, I would want my custom filter invoked (implicitly) on both term
> queries above.
> Is there an alternative to doing the above without preprocessing the query
> and explicitly inserting my custom filter everywhere?
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/80f569b4-efca-4c46-a028-0220cfb61375%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/80f569b4-efca-4c46-a028-0220cfb61375%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBfZHPSRiRTiZJ%2BngcRXZ2PdJQFi8JBx-TK1MRHc81Y_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to