Smart date analyzer

Is there an exiting analyzer for smart date analysis.
For example,
if the document contains the date like " 06.25.2008" or "06/25/2008", I can fetch the doc even searching for "June 25 2008".
Or vice versa, the doc contains "June 25 2008", I can fetch it if searching "06/25/2008".

Not really an analyzer but You can add many formats to a date field in your mapping.
Elasticsearch will try all of them.

I'm not completely sure if this helps but you specify multiple date formats for a date field. For example (untested):

`PUT my_index
{
  "mappings": {
    "my_type": {
      "properties": {
        "date": {
          "type":   "date",
          "format": "basicDate||date||mm.dd.yyyy||mm/dd/yyyy"
        }
      }
    }
  }
}`

See https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.html#built-in-date-formats for details as to the supported formats.

1 Like