Comparing arrays

I have documents with an array field. The array contains unique elements
only. In this case the data is strings and but it could be numbers.

I want to search for documents using this array field. Ideally I would like
to pass in an array and find the "nearest match" meaning documents which
contain all or most of the elements in the array I passed in.

For example "find me all the documents with the array field similar to
['this', 'that', 'the other thing']"

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGuHJrM3oasfU1tX-_VDPB6seDnzwYP32XKeQCKuySGNgLitKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

On Tuesday, September 23, 2014 2:18:35 PM UTC+12, Tim Uckun wrote:

I have documents with an array field. The array contains unique elements
only. In this case the data is strings and but it could be numbers.

I want to search for documents using this array field. Ideally I would
like to pass in an array and find the "nearest match" meaning documents
which contain all or most of the elements in the array I passed in.

For example "find me all the documents with the array field similar to
['this', 'that', 'the other thing']"

Hey guys I hate to bump myself up but does anybody have any hints on how
this could be done?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/0c705855-5684-45c5-902b-e310178f8e1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I suppose you could simply create a "bool" search with "should" clauses on
all of the values, like

"query": {
"bool": [
"should": { "term": {"array": "this"}},
"should": { "term": {"array": "that"}},
"should": { "term": {"array": "other"}}
]
}

If you want you can use the minimum_should_match field too, or use a
different query type if you want more control over the sorting and
filtering of the results?

Anne

On Thu, Sep 25, 2014 at 5:49 AM, Tim Uckun timuckun@gmail.com wrote:

On Tuesday, September 23, 2014 2:18:35 PM UTC+12, Tim Uckun wrote:

I have documents with an array field. The array contains unique elements
only. In this case the data is strings and but it could be numbers.

I want to search for documents using this array field. Ideally I would
like to pass in an array and find the "nearest match" meaning documents
which contain all or most of the elements in the array I passed in.

For example "find me all the documents with the array field similar to
['this', 'that', 'the other thing']"

Hey guys I hate to bump myself up but does anybody have any hints on how
this could be done?

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/0c705855-5684-45c5-902b-e310178f8e1d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/0c705855-5684-45c5-902b-e310178f8e1d%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
Anne Veling
BeyondTrees.com
+31 6 50 969 170
@anneveling

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAAwWRi%2BuaEYEqT2S4PamfVYRZLAgRoOuSfav6Z0Lqz6Nj40%3DXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Hello Tim ,

The default similarity already have this logic in it , but then am sure
there are other logics too applied for default similarity.
I am not sure how to use this function logic alone for scoring.

But then , in worst case you can do as follows , but am sure there should
exist and better way for thos.
Create a script in scoring and use the ( score =
_index['FIELD']['TERM'].tf() > 0 ? 1 : 0 ) and sum all the score for each
term as the score of that document. -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-advanced-scripting.html

Thanks
vineeth

On Thu, Sep 25, 2014 at 9:19 AM, Tim Uckun timuckun@gmail.com wrote:

On Tuesday, September 23, 2014 2:18:35 PM UTC+12, Tim Uckun wrote:

I have documents with an array field. The array contains unique elements
only. In this case the data is strings and but it could be numbers.

I want to search for documents using this array field. Ideally I would
like to pass in an array and find the "nearest match" meaning documents
which contain all or most of the elements in the array I passed in.

For example "find me all the documents with the array field similar to
['this', 'that', 'the other thing']"

Hey guys I hate to bump myself up but does anybody have any hints on how
this could be done?

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/0c705855-5684-45c5-902b-e310178f8e1d%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/0c705855-5684-45c5-902b-e310178f8e1d%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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5mgz7hVRC8VjJyhpEm8QLk%3DSJYr96sS-zrQe%2Bqy1UqX%2BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.