0

I am trying to get my Elasticsearh query to work, but I get this error:

org.elasticsearch.common.ParsingException: [match] unknown token [START_ARRAY] after [query]

This is my query:

{
    "size": 25,
    "from": 0,
    "sort": [
        {
            "r_date.keyword": {
                "order": "desc"
            }
        }
    ],
    "query": {
        "bool": {
            "must": [
                {
                    "match": {
                        "c_id": {
                            "query": ["TSM"]//it should accept multiple values
                        }
                    }
                },
                {
                    "match": {
                        "sec": {
                            "query": 
                                "500"
                            
                        }
                    }
                },
                {
                    "range": {
                        "r_date": {
                            "gte": "02/28/2023",
                            "lte": "08/29/2023",
                            "format": "MM/dd/yyyy"
                        }
                    }
                }
            ]
        }
    }
}
Ajay Takur
  • 6,079
  • 5
  • 39
  • 55
  • Do you receive the same error in case of using a short match syntax, like: {"match":{"c_id":"TSM"} ? – Vakhtang Aug 29 '23 at 11:37
  • I am getting issues while passing multiple values in array. – Ajay Takur Aug 29 '23 at 12:22
  • You already asked the same question [here](https://stackoverflow.com/questions/76948090/how-to-fetch-documents-with-must-match-clause-in-elastic-search-8-9-v) I answered it and you accepted it (hint: match doesn't accept an array) – Val Aug 29 '23 at 12:46
  • You also probably overlooked [this answer](https://stackoverflow.com/a/76956424/4604579) which indicates that `match` doesn't take arrays as input but simply a string of text. – Val Aug 29 '23 at 13:35
  • how to receive multiple strings in an array? – Ajay Takur Aug 29 '23 at 15:01
  • I wanted to have the syntax when i receive more than one string should be able to work also. – Ajay Takur Aug 29 '23 at 15:26

0 Answers0