I want that when the end user will search for "Lebron", it won't match this document.
When he will search "Lebron James", it should match it.
When he will search "Lebron James Basketball", or "nba Lebron James", it should also match the document.
Is it possible to do?
I tried to to terms queries, but in that case, "Lebron James Basketball", or "nba Lebron James" doesn't match.
I tried to add analyzers, with standard tokenizer.
But the search "Lebron" matches the document, and I don't want that behaviour.
I also tried to add an analyzer with "keyword" tokenizer, and to change the type of my field from "text" to "keyword".
But none of those configurations match "Lebron James Basketball", or "nba Lebron James" .
I'm not sure it is possible to do in Elastic.
If you have any idea, I thank you in advance!
I think you will have to have your document type as nested or searches like "Lebron Jordan" would show up. Don't think this is an ideal solution but the below works.
Thanks Aaron for your answer.
I will try to adapt your example.
To clarify my first example, the field I want to query wont always contain first and last names.
It will contains some keywords referencing the document.
It could be:
"attributes": [
"Lebron James",
"fast red car",
"this is a long keyword"
]
And, at query time, I don't know the content of the field "attributes".
In this exemple, I want the query "This is a fast red car" to match the document (because the input of the user match the complete string of attributes field, even if the user has added more keywords ("this is a") )
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.