Help with error -

getting this error when i query in elasticsearch 5.2.0
failed to parse date field [afas] with format [strict_date_optional_time||epoch_millis]
Query-

{
 "from": "0",
 "size": "10",
 "query": {
  "bool": {
     "filter": [
        {
           "bool": {
              "must_not": [
                 {
                    "terms": {
                       "source": [
                          "report",
                          "dashboard",
                          "reportsheet",
                          "users"
                       ]
                    }
                 },
                 {
                    "terms": {
                       "_type": [
                          "metadata"
                       ]
                    }
                 }
              ]
           }
        }
     ],
     "should": [
        {
           "multi_match": {
              "query": "afas",
              "type": "phrase",
              "boost": 10,
              "fields": [
                 "tag.*"
              ]
           }
        },
        {
           "multi_match": {
              "query": "sdf",
              "type": "phrase_prefix",
              "fields": [
                 "tag.*"
              ]
           }
        }
     ],
     "minimum_number_should_match": 1
   }
},
"highlight": {
  "fields": {
     "tag.*": {},
     "dimension_attribute.*": {}
  }
}

mapping looks like-

  {
  "settings": {
  "index.mapping.total_fields.limit": 2000,
  "analysis": {
     "analyzer": {
        "analyzer_startswith": {
           "type": "custom",
           "tokenizer": "keyword",
           "filter": [
              "lowercase"
           ]
        }
     }
  }
 },
 "mappings": {
  "fact": {
     "dynamic_templates": [
        {
           "double": {
              "match_mapping_type": "double",
              "mapping": {
                 "type": "string"
              }
           }
        },
        {
           "long": {
              "match_mapping_type": "long",
              "mapping": {
                 "type": "string"
              }
           }
        }
     ]
  },
  "dimension": {
     "dynamic_templates": [
        {
           "double": {
              "match_mapping_type": "double",
              "mapping": {
                 "type": "string"
              }
           }
        },
        {
           "long": {
              "match_mapping_type": "long",
              "mapping": {
                 "type": "string"
              }
           }
        },
        {
           "tag_startswith": {
              "match_mapping_type": "string",
              "path_match": "tag.*",
              "mapping": {
                 "type": "string"
              }
           }
        },
        {
           "dimAttr_startswith": {
              "match_mapping_type": "string",
              "path_match": "dimension_attribute.*",
              "mapping": {
                 "type": "string",
                 "analyzer": "analyzer_startswith"
              }
           }
        }
       ]
    }
   }
 }

Please help

Can you share the mapping? Not the template.

I thought the mapping i mentioned is the only one?
Do you want the whole mapping?
its too big to mention here.

Yes please. Post it on gist.github.com and paste the link here.

Here you go

Hope that works

I think i found out what the issue might be.There is a field called validfrom under tag that is of type date. That might be causing the issue.Am i right?

The message is failed to parse date field [afas] with format [strict_date_optional_time||epoch_millis]

I can't find this field afas in your mapping.

Are you sure you are sending me the right information?

Thats the query keyword. I don't know why its referring to it as a field.

I misread the error message. Indeed you are trying to match all fields including date ones with a text.

That can't work.

How do i change the mapping to convert the date to string.

You have to reindex

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