# Getting "parser not found" error on a filter date range aggregation

**URL:** <https://discuss.elastic.co/t/getting-parser-not-found-error-on-a-filter-date-range-aggregation/103399>\
**Category:** Elasticsearch\
**Created:** [October 10, 2017, 3:09pm UTC](https://discuss.elastic.co/t/getting-parser-not-found-error-on-a-filter-date-range-aggregation/103399 "2017-10-10T15:09:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdesoyres](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pdesoyres/32/509_2.png) [@pdesoyres](https://discuss.elastic.co/u/pdesoyres)\
**Post date:** [October 10, 2017, 3:09pm UTC](https://discuss.elastic.co/t/getting-parser-not-found-error-on-a-filter-date-range-aggregation/103399/1 "2017-10-10T15:09:24Z")

</div>

I have the following mapping :

```
{
  "my_index": {
    "mappings": {
      "my_type": {
        "properties": {
          "date": {
            "type": "date",
            "format": "strict_date_optional_time||epoch_millis||dd/MM/yyyy HH:mm"
          }
         "data": {
           "type": "keyword"
         }
        }
      }
    }
  }
}

```

And I post the following query :

```
{
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        }
      ]
    }
  },
  "aggs": {
    "filter": {
      "range": {
        "date": {
          "gte": 1476108600401,
          "lte": 1507644600401,
          "format": "epoch_millis"
        }
      }
    },
    "aggs": {
      "value": {
        "terms": {
          "field": "value",
          "size": 10
        }
      }
    }
  }
}

```

And I get the following error;

```
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "[range] unknown field [date], parser not found"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "[range] unknown field [date], parser not found"
  },
  "status": 400
}

```

Note that when removing the range query and move it to the query part, everything works fine :

```
{
  "query": {
    "bool": {
      "must": [
        {
          "match_all": {}
        },
        {
          "range": {
            "date": {
              "gte": 1476108600401,
              "lte": 1507644600401,
              "format": "epoch_millis"
            }
          }
        }
      ]
    }
  }
}

```

Is there something I missed ?

I'm using elasticsearch 5.5.0

_Pierre._

---

<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:** [October 10, 2017, 3:29pm UTC](https://discuss.elastic.co/t/getting-parser-not-found-error-on-a-filter-date-range-aggregation/103399/2 "2017-10-10T15:29:52Z")

</div>

The mapping is wrong. You edited it manually while posting.

Could you provide a full recreation script as described in

> [@About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21):
>
> The heart of the free and open Elastic Stack Elasticsearch is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases. As the heart of the Elastic Stack, it centrally stores your data for lightning fast search, fine‑tuned relevancy, and powerful analytics that scale with ease. warning PLEASE READ THIS SECTION IF IT'S YOUR FIRST POST Some useful links: [elasticsearch reference guide](http://www.elastic.co/guide/en/elasticsearch/reference/current/index.html)[elasticsearch user guide](http://www.elastic.co/guide/en/elasticsearch/guide/current/index.html)[elasticsearch plugins](https://www.elastic.co/guide/en/elasticsearch/plugins/current/index.html)[elasticsearch cl…](https://www.elastic.co/guide/en/elasticsearch/client/index.html)

It will help to better understand what you are doing.  
Please, try to keep the example as simple as possible.

---

<div class="post-metadata">

**Author:** ![pdesoyres](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pdesoyres/32/509_2.png) [@pdesoyres](https://discuss.elastic.co/u/pdesoyres)\
**Post date:** [October 10, 2017, 3:33pm UTC](https://discuss.elastic.co/t/getting-parser-not-found-error-on-a-filter-date-range-aggregation/103399/3 "2017-10-10T15:33:54Z")

</div>

Sorry, you're right here is the index creation :

```
PUT my_idx
{
    "mappings": {
      "my_type": {
        "properties": {
          "date": {
            "type": "date",
            "format": "strict_date_optional_time||epoch_millis||dd/MM/yyyy HH:mm"
          },
         "data": {
           "type": "keyword"
         }
        }
      }
    }
  }
```

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [October 10, 2017, 3:35pm UTC](https://discuss.elastic.co/t/getting-parser-not-found-error-on-a-filter-date-range-aggregation/103399/4 "2017-10-10T15:35:31Z")

</div>

It looks like you are missing the object for the name of your aggregation inside the aggs object. I think it should instead be:

```auto
"aggs": {
  "my_filter_agg": {
    "filter": {
      "range": {
        "date": {
          "gte": 1476108600401,
          "lte": 1507644600401,
          "format": "epoch_millis"
        }
      }
    },
    "aggs": {
      "value": {
        "terms": {
          "field": "value",
          "size": 10
        }
      }
    }
  }
}

```

The error message is stating that it doesn't know about the field "date" in the JSON for the range aggregation because its interpreted the name of the aggregation as `filter` and the type of aggregation as `range` so its trying to map the `date` to a parameter for the range aggregation which doesn't exist

---

<div class="post-metadata">

**Author:** ![pdesoyres](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pdesoyres/32/509_2.png) [@pdesoyres](https://discuss.elastic.co/u/pdesoyres)\
**Post date:** [October 10, 2017, 3:40pm UTC](https://discuss.elastic.co/t/getting-parser-not-found-error-on-a-filter-date-range-aggregation/103399/5 "2017-10-10T15:40:48Z")

</div>

OOooh yes, you're right. Thank you !

---

<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:** [November 7, 2017, 3:40pm UTC](https://discuss.elastic.co/t/getting-parser-not-found-error-on-a-filter-date-range-aggregation/103399/6 "2017-11-07T15:40:52Z")

</div>

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