Possible to use Lucene filters?


(Sten Roger Sandvik) #1

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 :slight_smile:

BR,
Sten Roger


(Shay Banon) #2

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 stenrs@gmail.com 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 :slight_smile:

BR,
Sten Roger


(Sten Roger Sandvik) #3

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

On Sep 28, 12:32 pm, Shay Banon kim...@gmail.com 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 ste...@gmail.com 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 :slight_smile:

BR,
Sten Roger


(Drew J. Sonne) #4

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 stenrs@gmail.com 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 :slight_smile:

BR,
Sten Roger


(system) #5