# Can not filter & aggregate on date values

**URL:** <https://discuss.elastic.co/t/can-not-filter-aggregate-on-date-values/43526>\
**Category:** Elasticsearch\
**Created:** [March 4, 2016, 3:31pm UTC](https://discuss.elastic.co/t/can-not-filter-aggregate-on-date-values/43526 "2016-03-04T15:31:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![okozacz](https://avatars.discourse-cdn.com/v4/letter/o/ac8455/32.png) [@okozacz](https://discuss.elastic.co/u/okozacz)\
**Post date:** [March 4, 2016, 3:31pm UTC](https://discuss.elastic.co/t/can-not-filter-aggregate-on-date-values/43526/1 "2016-03-04T15:31:48Z")

</div>

Hey folks,

I have a problem: I create a dynamic for some tracking data (JSON) index like this:

```
PUT test
{
"settings": {
    "index.mapping.ignore_malformed":true

  },
  "mappings": {
    "supersonic": {
      
          "dynamic": "true",
          "dynamic_templates": [
            {
               "dates": {
                  "match": ".*Date.*|.*date.*|.*timestamp.*|.*Timestamp.*",
                  "match_pattern": "regex",
                  "mapping": {
                     "type": "date"
                  }
               }
            }
          ]
        }
      }
    }
}

```

As soon as the first message hits the index, it is created like this:

```
{
  "test": {
    "aliases": {},
    "mappings": {
      "supersonic": {
        "dynamic": "true",
        "dynamic_templates": [
          {
            "dates": {
              "mapping": {
                "type": "date"
              },
              "match": ".*Date.*|.*date.*|.*timestamp.*|.*Timestamp.*",
              "match_pattern": "regex"
            }
          }
        ],
        "properties": {
          "battle_id": {
            "type": "string"
          },
          "current_hp": {
            "type": "double"
          },
          "date": {
            "type": "date",
            "format": "strict_date_optional_time||epoch_millis"
          },
          "entity_elements": {
            "type": "string"
          },
          "entity_type": {
            "type": "double"
          },
          "eventId": {
            "type": "double"
          },
          "gameId": {
            "type": "double"
          },
          "instanceId": {
            "type": "double"
          },
          "ipLong": {
            "type": "double"
          },
          "ipLongForwarded": {
            "type": "double"
          },
          "ipLongPeer": {
            "type": "double"
          },
          "networkId": {
            "type": "double"
          },
          "platform_id": {
            "type": "double"
          },
          "playerId": {
            "type": "string"
          },
          "pos_x": {
            "type": "double"
          },
          "pos_y": {
            "type": "double"
          },
          "room_x": {
            "type": "double"
          },
          "room_y": {
            "type": "double"
          },
          "stage_id": {
            "type": "double"
          },
          "timestamp": {
            "type": "date",
            "format": "strict_date_optional_time||epoch_millis"
          },
          "trevor_date": {
            "type": "date",
            "format": "strict_date_optional_time||epoch_millis"
          },
          "tsEventAccepted": {
            "type": "double"
          },
          "version": {
            "type": "string"
          }
        }
      }
    },
    "settings": {
      "index": {
        "creation_date": "1457095891176",
        "mapping": {
          "ignore_malformed": "true"
        },
        "uuid": "6qz6SDXIQQuof9XB6OaBQw",
        "number_of_replicas": "1",
        "number_of_shards": "5",
        "version": {
          "created": "2020099"
        }
      }
    },
    "warmers": {}
  }
}

```

The data arrives, is indexed, and everything looks fine in Kibana. But when I try to filter by a date (when I pick it from the right side, so it HAS to be there, or do a date histogram for example, it shows "No results found"

Nothing suspicious in the logs, I don't know how to investigate further :-/

I am using ES 2.2.0 and Kibana 4.4.1 and I am really grateful about any help, I already spent a lot of time on this and can't see why it won't work, since it's very very basic stuff.

---

<div class="post-metadata">

**Author:** ![okozacz](https://avatars.discourse-cdn.com/v4/letter/o/ac8455/32.png) [@okozacz](https://discuss.elastic.co/u/okozacz)\
**Post date:** [March 4, 2016, 3:32pm UTC](https://discuss.elastic.co/t/can-not-filter-aggregate-on-date-values/43526/2 "2016-03-04T15:32:06Z")

</div>

An example JSON would be:

```
{
  "_index": "test",
  "_type": "supersonic",
  "_id": "AVNCNANiQbEmhEWmUojq",
  "_score": 1,
  "_source": {
    "instanceId": 0,
    "room_y": -76,
    "battle_id": "2016.02.15.10.48.10.7193440.7205372",
    "tsEventAccepted": 1455529989,
    "networkId": 0,
    "pos_y": -78,
    "timestamp": 1455529989,
    "trevor_date": 1455529989987,
    "gameId": 30,
    "ipLongPeer": 2130706433,
    "entity_type": 1100,
    "eventId": 949,
    "version": "5.3.1p1",
    "date": 1455529989,
    "ipLong": 3561950994,
    "current_hp": 50,
    "ipLongForwarded": 3561950994,
    "playerId": "Guest",
    "entity_elements": "BA_1_0_0_0_0",
    "pos_x": 24,
    "stage_id": 0,
    "platform_id": -1,
    "room_x": 23
  }
}
```

---

<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:** [July 5, 2017, 11:11pm UTC](https://discuss.elastic.co/t/can-not-filter-aggregate-on-date-values/43526/3 "2017-07-05T23:11:11Z")

</div>


