Consider I have a text field called 'question' with element ['one','one shift','one apple'].
Now say the query is 'one' with the following search query:
I want the scoring function to use the best score among the three matches 'one', 'one shift', 'one apple' for the text field. How should I modify that? I am aware there is a function score query, but I am not sure how to achieve that.
I'm not sure I understand the question.
For the given query, the document with the given question field would be returned as search result. The overall relevancy score for this document would depend on the tf, idf algorithm. There is no other competing field in query so you will get the best score for the document.
Are you seeing something else?
I my opinion, I do not think there is any difference in the indexing (and subsequent matching) between a regular text datatype or array datatype.
For example ...
GET myindex/_analyze
{
"field":"title",
"text" : "Cognitive Computing"
}
GET myindex/_analyze
{
"field":"title",
"text" : ["Cognitive", "Computing"]
}
... yields exactly the same tokens. The specifics are then down to tf idf etc that in turn, as i said do not vary as the basic datatype of both fields is same - string/text.
Are you seeing any difference/unexpected outcome in behaviour?
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.