Match a indexed field with array of strings


Currently, I am using Elasticsearch version 5.3.2.
I have multiple documents in the below format:
"question":"What is 1004 divided by 2?",
"answer":" A. 52, B. 502, C. 520,D. 5002",
"category": "math"
"question":"Which is the nearest star to planet earth? ",
"category": "general knowledge"
"question":"Which is the heavier metal of these two? Gold or Silver? ",
"category": "science"

I want to fetch documents with a category that falls under an array ["math","science"].

I have tried using terms query. But that didn't work.
My query was like :
"query": {
"bool": {
"should": {
"terms": { "category": ["math","science"]}

Help me with this.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.