How do I pass a list as query string to match_phrase query?
This works:
{"match_phrase": {"requestParameters.bucketName": {"query": "xxx"}}},
This does not:
{
"match_phrase": {
"requestParameters.bucketName": {
"query": [
"auditloggingnew2232",
"config-bucket-123",
"web-servers",
"esbck-essnap-1djjegwy9fvyl",
"tempexpo",
]
}
}
}
match_phrasesimply does not support multiple values.You can either use a
shouldquery:or, as @Val pointed out, a
termsquery:that functions like an
ORon exact terms.I'm assuming that 1) the bucket names in question are unique and 2) that you're not looking for partial matches. If that's the case, plus if there are barely any analyzers set on the field
bucketName,match_phrasemay not even be needed!termswill do just fine. The difference betweentermandmatch_phrasequeries is nicely explained here.