# Search after doesn't work with date type. Is it bug?

**URL:** <https://discuss.elastic.co/t/search-after-doesnt-work-with-date-type-is-it-bug/112262>\
**Category:** Elasticsearch\
**Created:** [December 18, 2017, 3:04pm UTC](https://discuss.elastic.co/t/search-after-doesnt-work-with-date-type-is-it-bug/112262 "2017-12-18T15:04:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vitaly\_Igorevich](https://avatars.discourse-cdn.com/v4/letter/v/c89c15/32.png) [@Vitaly\_Igorevich](https://discuss.elastic.co/u/Vitaly_Igorevich)\
**Post date:** [December 18, 2017, 3:04pm UTC](https://discuss.elastic.co/t/search-after-doesnt-work-with-date-type-is-it-bug/112262/1 "2017-12-18T15:04:44Z")

</div>

Elasticsearch 6.1  
Mapping:  
{  
"posts" : {  
"mappings" : {  
"post" : {  
"dynamic" : "false",  
"properties" : {  
"created\_at" : {  
"type" : "date",  
},  
"format" : "epoch\_second"  
},  
}  
}  
}  
}  
}

Query:  
{  
"size":25,  
"query":{  
"bool":{  
"filter":[

```
         ]
      }
   },
   "sort":[
      {
         "created_at":"desc"
      },
      {
         "_id":"desc"
      }
   ],
   "search_after":[
      1513608331,
      "2"
   ]
}

```

This query return empty result. But when i create field with type keyword like this it works well. Is it bug?  
Mapping:  
{  
"posts" : {  
"mappings" : {  
"post" : {  
"dynamic" : "false",  
"properties" : {  
"created\_at" : {  
"type" : "date",  
"fields" : {  
"keyword" : {  
"type" : "keyword"  
}  
},  
"format" : "epoch\_second"  
},  
}  
}  
}  
}  
}

Query:  
{  
"size":25,  
"query":{  
"bool":{  
"filter":[

```
         ]
      }
   },
   "sort":[
      {
         "created_at.keyword":"desc"
      },
      {
         "_id":"desc"
      }
   ],
   "search_after":[
      1513608331,
      "2"
   ]
}
```

---

<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:** [January 15, 2018, 3:04pm UTC](https://discuss.elastic.co/t/search-after-doesnt-work-with-date-type-is-it-bug/112262/2 "2018-01-15T15:04:44Z")

</div>

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