Thanks for the quick reply. unless I am missing something, these suggestions do not quite do what I need...
1) alias filters would not work since the filters associated with them are static, whereas I would need a dynamic a filter (one with params, so each query will include the specific values to filter for, depending on who is querying) 2) not sure how templates work for this... an elaboration would be appreciated. On Thursday, 29 May 2014 14:16:39 UTC-4, Ivan Brusic wrote: > > 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] > <javascript:>>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] <javascript:>. >> 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/e8fd192f-0d6b-4227-bcd5-64458ad29042%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
