if my filter is just one word like samsung or Apple. it works fine but if its a phrase like general social survey. even though I have that exact phrase in my index, it gives me zero result. cant the filter be a phrase.
i ended up using match_phrase because the filter query that is selected is a phrase instead of one term. so using terms even though I was able to pass multiple values i was only able to pass a term not a phrase. but now here, each query of the match_phrase is a faceted search.
Basically, i have a list of survey and list of search, user can select multiple surveys and subjects, how do I handle that.
What you are doing in there is that it's looking for a "Aboriginal Peoples survey" survey AND "population characteristics" subject. Maybe it is the reason why you're not getting anything when fetching it.
Maybe you need to rearrange the query structure to look for one thing or another.
You can wrap this filter in a should clause in a bool query and set the minimum_should_match option to 1.
What you are suggesting is, it will give results if the document matches either survey or the subjects.
I would like those documents to match who has this survey and this subject both, but here I can only pass a single phrase of subject and survey, I would like to be able to pass an array. I will be storing it as an search template so later on I can just give it a list of subjects and list of surveys.
any suggestions would be helpful. thanks for your time.
I have tried this. The issue with this is since its terms, its searches for "phrase" and "1" in subjects however, I want it to match the subjects that has exactly" phrase 1". but match_phrase is not able to take an array. I am actually converting these query in a search template. so the subjects filter should be able to take a list .
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.