# No mapping found in order to sort on (Dates)

**URL:** <https://discuss.elastic.co/t/no-mapping-found-in-order-to-sort-on-dates/142640>\
**Category:** Elasticsearch\
**Created:** [August 1, 2018, 6:23pm UTC](https://discuss.elastic.co/t/no-mapping-found-in-order-to-sort-on-dates/142640 "2018-08-01T18:23:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Etienne\_Poulin](https://avatars.discourse-cdn.com/v4/letter/e/eb9ed0/32.png) [@Etienne\_Poulin](https://discuss.elastic.co/u/Etienne_Poulin)\
**Post date:** [August 1, 2018, 6:23pm UTC](https://discuss.elastic.co/t/no-mapping-found-in-order-to-sort-on-dates/142640/1 "2018-08-01T18:23:22Z")

</div>

So I'm trying to order my logs by date. I'm currently querying `http://localhost:9200/myindex/_search?pretty=true&sort="date"` without the pretty, within a java app. When I do that, I'm getting the following error:

```
{
  "error" : {
    "root_cause" : [
      {
        "type" : "query_shard_exception",
        "reason" : "No mapping found for [\"date\"] in order to sort on",
        "index_uuid" : "vbAJhP7bTGK4bLdOyX3IdA",
        "index" : "myindex"
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "myindex",
        "node" : "vWwnROc0Qiq-WGNRvRROoA",
        "reason" : {
          "type" : "query_shard_exception",
          "reason" : "No mapping found for [\"date\"] in order to sort on",
          "index_uuid" : "vbAJhP7bTGK4bLdOyX3IdA",
          "index" : "myindex"
        }
      }
    ]
  },
  "status" : 400
}

```

And when I querry \_mapping, here are the results:

```
    {
  "myindex" : {
    "mappings" : {
      "doc" : {
        "properties" : {
          "date" : {
            "type" : "date",
            "format" : "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis"
          },
          "message" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          },
          "type" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          }
        }
      }
    }
  }
}

```

What do I need to do make it work ?

---

<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:** [August 2, 2018, 7:17am UTC](https://discuss.elastic.co/t/no-mapping-found-in-order-to-sort-on-dates/142640/2 "2018-08-02T07:17:37Z")

</div>

The right syntax is:

```auto
GET test/_search?sort=date

```

Not

```auto
GET test/_search?sort="date"

```

---

<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:** [August 30, 2018, 7:17am UTC](https://discuss.elastic.co/t/no-mapping-found-in-order-to-sort-on-dates/142640/3 "2018-08-30T07:17:52Z")

</div>

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