- Below query will give search the document with programmer or tester
query = {'from': 0, 'size': 30, 'query': {'bool': {'must': {'query_string': {'query': '*programmer* OR *tester*'}}}}}
How to get document contain programmer and tester
not manager
Below query not working.
query = {'from': 0, 'size': 30, 'query': {'bool': {'must': {'query_string': {'query': '*programmer* AND *tester* NOT *manager*'}}}}}
Q2: Also many result are popping up for me, how to give show only the result min_score > 5 ?
Q3: If i want to extract document with 'programmer AND tester AND manager, if three strings(programmer, tester,manager) are present then only how to extract?
CodePudding user response:
You can use must_not
query. This is an example query:
{
"from": 0,
"size": 30,
"query": {
"bool": {
"must": {
"query_string": {
"query": "*programmer* OR *tester*"
}
},
"must_not": {
"query_string": {
"query": "*manager*"
}
}
}
}
}
This should also work without a must_not
query:
(*programmer* OR *tester*) AND NOT *manager*