Possible to use Lucene filters?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible to use Lucene filters?

Sten Roger Sandvik

Hi.

Is it possible to use Lucene filters inside ElasticSearch? Or somesort
of bitset manipulation of the document result?

The reason I ask is that we want to restrict read access for certain
users on certain documents. It can be alot of users and we do not want
to index those rights if it's another possibility. Until now I have a
custom search based on lucene, but want to use ElasticSearch instead.
In our custom implementation we add a security filter that looks up in
a table (or map) for each key and filter out those that will not be in
the result.

Hope that someone has the answer :-)

BR,
Sten Roger
Reply | Threaded
Open this post in threaded view
|

Re: Possible to use Lucene filters?

kimchy
Administrator
You can plug your own custom filter parser. It needs to both be able to parse the representation of the filter, and then create it. See a sample for the simple term filter: https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/TermFilterParser.java.

Once you have that, you can write a plugin that adds your own custom filter parser registered under a name by checking on IndexQueryParserModule instance, and using the addFilterParser on it.

On Wed, Sep 28, 2011 at 12:06 PM, Sten Roger <[hidden email]> wrote:

Hi.

Is it possible to use Lucene filters inside ElasticSearch? Or somesort
of bitset manipulation of the document result?

The reason I ask is that we want to restrict read access for certain
users on certain documents. It can be alot of users and we do not want
to index those rights if it's another possibility. Until now I have a
custom search based on lucene, but want to use ElasticSearch instead.
In our custom implementation we add a security filter that looks up in
a table (or map) for each key and filter out those that will not be in
the result.

Hope that someone has the answer :-)

BR,
Sten Roger

Reply | Threaded
Open this post in threaded view
|

Re: Possible to use Lucene filters?

Sten Roger Sandvik

Thanks for a very fast response. This is what I am looking for.
Thank's alot!

On Sep 28, 12:32 pm, Shay Banon <[hidden email]> wrote:

> You can plug your own custom filter parser. It needs to both be able to
> parse the representation of the filter, and then create it. See a sample for
> the simple term filter:https://github.com/elasticsearch/elasticsearch/blob/master/modules/el...
> .
>
> Once you have that, you can write a plugin that adds your own custom filter
> parser registered under a name by checking on IndexQueryParserModule
> instance, and using the addFilterParser on it.
>
>
>
>
>
>
>
> On Wed, Sep 28, 2011 at 12:06 PM, Sten Roger <[hidden email]> wrote:
>
> > Hi.
>
> > Is it possible to use Lucene filters inside ElasticSearch? Or somesort
> > of bitset manipulation of the document result?
>
> > The reason I ask is that we want to restrict read access for certain
> > users on certain documents. It can be alot of users and we do not want
> > to index those rights if it's another possibility. Until now I have a
> > custom search based on lucene, but want to use ElasticSearch instead.
> > In our custom implementation we add a security filter that looks up in
> > a table (or map) for each key and filter out those that will not be in
> > the result.
>
> > Hope that someone has the answer :-)
>
> > BR,
> > Sten Roger
Reply | Threaded
Open this post in threaded view
|

Re: Possible to use Lucene filters?

Drew J. Sonne
In reply to this post by kimchy
The mentioned URL is now here:  https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/query/TermFilterParser.java 

On Wednesday, September 28, 2011 8:32:02 PM UTC+10, kimchy wrote:
You can plug your own custom filter parser. It needs to both be able to parse the representation of the filter, and then create it. See a sample for the simple term filter: https://github.com/elasticsearch/elasticsearch/blob/master/modules/elasticsearch/src/main/java/org/elasticsearch/index/query/TermFilterParser.java.

Once you have that, you can write a plugin that adds your own custom filter parser registered under a name by checking on IndexQueryParserModule instance, and using the addFilterParser on it.

On Wed, Sep 28, 2011 at 12:06 PM, Sten Roger <[hidden email]> wrote:

Hi.

Is it possible to use Lucene filters inside ElasticSearch? Or somesort
of bitset manipulation of the document result?

The reason I ask is that we want to restrict read access for certain
users on certain documents. It can be alot of users and we do not want
to index those rights if it's another possibility. Until now I have a
custom search based on lucene, but want to use ElasticSearch instead.
In our custom implementation we add a security filter that looks up in
a table (or map) for each key and filter out those that will not be in
the result.

Hope that someone has the answer :-)

BR,
Sten Roger