Computing intesecting sets on searches

Hi,

I have indexed documents with tags and want to be able to fetch
documents that match a query given the following constraint...

Say doc1 has tags [a,b] and during a query I would like to compute an
intersection given an ad hoc tags array
in the form off [a,b] & [a,b,c] = [a,b] ie compute the intersection
between the 2 sets and check that it returns the original document tag set.

I've been looking a script filters but seems that mvel does not support
an operator/function to intersect array types.

Any suggestions?

Thanks!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Fernand,

Mvel gives you access to all Java classes so you can instantiate sets from
the arrays and do your thing.

How important is performance for you? If this is more than just a quick
test, I will use combination of scoring and filters to figure out whether
you have the right number of hits. In your example, search for "a" OR "b"
with using filters and constant score (or
potentially Elasticsearch Platform — Find real-time answers at scale | Elastic
) and then filter using a script filter all document whose score doesn't
equal to the number of elements in their tag array.

Cheers,
Boaz

On Monday, August 26, 2013 9:43:39 PM UTC+2, Fernand Galiana wrote:

Hi,

I have indexed documents with tags and want to be able to fetch
documents that match a query given the following constraint...

Say doc1 has tags [a,b] and during a query I would like to compute an
intersection given an ad hoc tags array
in the form off [a,b] & [a,b,c] = [a,b] ie compute the intersection
between the 2 sets and check that it returns the original document tag set.

I've been looking a script filters but seems that mvel does not support
an operator/function to intersect array types.

Any suggestions?

Thanks!

--
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.
For more options, visit https://groups.google.com/groups/opt_out.