Term query for date type field doesn't work if query is list

Hi,
I inserted a data whose data type is "date".
Then I tried to find the data by term query. If search query contains one value, it works but if search query contain a list of value, I get exception.
If data type of inserted data is keyword, both case works well.

I would like to know whether this is expected behavior or not.
Thank you in advance.
======================Below query doesn't work====================
"term" : {
"sell_date" : {
"value" : [
"2020-01-01",
"2020-01-02"
]
}
======================Below query works well====================
"term" : {
"sell_date" : {
"value" : "2020-01-01"
}
}

===============Exception message==================
"type": "parse_exception",
"reason": "failed to parse date field ] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field ] with format [strict_date_optional_time||epoch_millis]]",

I think you should be using 'terms' instead of 'term' when passing list. https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html

Sorry for late reply. I tried terms instead of term then it worked. Thank you very much.
But I feel error message needs to be improved.

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