# Help with error -

**URL:** <https://discuss.elastic.co/t/help-with-error/78962>\
**Category:** Elasticsearch\
**Created:** [March 17, 2017, 5:43am UTC](https://discuss.elastic.co/t/help-with-error/78962 "2017-03-17T05:43:44Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sharat\_Jagannath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharat_jagannath/32/24299_2.png) [@Sharat\_Jagannath](https://discuss.elastic.co/u/Sharat_Jagannath)\
**Post date:** [March 17, 2017, 5:43am UTC](https://discuss.elastic.co/t/help-with-error/78962/1 "2017-03-17T05:43:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 17, 2017, 6:31am UTC](https://discuss.elastic.co/t/help-with-error/78962/2 "2017-03-17T06:31:25Z")

</div>

Can you share the mapping? Not the template.

---

<div class="post-metadata">

**Author:** ![Sharat\_Jagannath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharat_jagannath/32/24299_2.png) [@Sharat\_Jagannath](https://discuss.elastic.co/u/Sharat_Jagannath)\
**Post date:** [March 17, 2017, 4:30pm UTC](https://discuss.elastic.co/t/help-with-error/78962/3 "2017-03-17T16:30:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 17, 2017, 4:50pm UTC](https://discuss.elastic.co/t/help-with-error/78962/4 "2017-03-17T16:50:53Z")

</div>

Yes please. Post it on [gist.github.com](http://gist.github.com) and paste the link here.

---

<div class="post-metadata">

**Author:** ![Sharat\_Jagannath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharat_jagannath/32/24299_2.png) [@Sharat\_Jagannath](https://discuss.elastic.co/u/Sharat_Jagannath)\
**Post date:** [March 17, 2017, 5:02pm UTC](https://discuss.elastic.co/t/help-with-error/78962/5 "2017-03-17T17:02:25Z")

</div>

> [@dadoonet](#):
>
> [gist.github.com](http://gist.github.com)

Here you go

> <https://gist.github.com/sharat7j/41f25d783ce870669dd87d49aaa6c818>

Hope that works

---

<div class="post-metadata">

**Author:** ![Sharat\_Jagannath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharat_jagannath/32/24299_2.png) [@Sharat\_Jagannath](https://discuss.elastic.co/u/Sharat_Jagannath)\
**Post date:** [March 17, 2017, 5:05pm UTC](https://discuss.elastic.co/t/help-with-error/78962/6 "2017-03-17T17:05:31Z")

</div>

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](http://issue.Am) i right?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 17, 2017, 5:31pm UTC](https://discuss.elastic.co/t/help-with-error/78962/7 "2017-03-17T17:31:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Sharat\_Jagannath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharat_jagannath/32/24299_2.png) [@Sharat\_Jagannath](https://discuss.elastic.co/u/Sharat_Jagannath)\
**Post date:** [March 17, 2017, 5:50pm UTC](https://discuss.elastic.co/t/help-with-error/78962/8 "2017-03-17T17:50:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 17, 2017, 6:15pm UTC](https://discuss.elastic.co/t/help-with-error/78962/9 "2017-03-17T18:15:07Z")

</div>

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

That can't work.

---

<div class="post-metadata">

**Author:** ![Sharat\_Jagannath](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sharat_jagannath/32/24299_2.png) [@Sharat\_Jagannath](https://discuss.elastic.co/u/Sharat_Jagannath)\
**Post date:** [March 17, 2017, 11:18pm UTC](https://discuss.elastic.co/t/help-with-error/78962/10 "2017-03-17T23:18:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 18, 2017, 2:46am UTC](https://discuss.elastic.co/t/help-with-error/78962/11 "2017-03-18T02:46:37Z")

</div>

You have to reindex

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 15, 2017, 2:46am UTC](https://discuss.elastic.co/t/help-with-error/78962/12 "2017-04-15T02:46:58Z")

</div>

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