Parsing date in a field query against a date field

Hello,

In my ES index I have a field defined as

releaseDate: {

  • include_in_all: true
  • format: dateOptionalTime
  • type: date

}

The way I understand dateOptionalTime format is that I should be able to
query the records using '2012' or '2012-02-16' or '2012-02-16T05:00:00.000Z'
(the actual value).

When I am querying the index (I am using elasticsearch-head) I get correct
results with the query

{

  • query: {
    • bool: {
      • must: [
        • {
          • term: {
            • releaseDate: 2012-02-16T05:00:00.000Z
              }
              }
              ]
              }
              }

}

If I use strings '2012' or '2012-02-16', I get no results. I would like to
be able to search against this field without using the time component. The
only way I found to do it is by using a range query:

{

  • query: {
    • bool: {
      • must: [
        • {
          • range: {
            • releaseDate: {
              • from: 2012-02-16
              • to: 2012-02-16
                }
                }
                }
                ]
      }
      }

}
Is there a way to use a term query and not have to specify the time
component?

Thank you,

Michael