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']"
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?
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?
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?
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. -
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?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.