# How to define mapping for sortable fields

**URL:** https://discuss.elastic.co/t/how-to-define-mapping-for-sortable-fields/131882
**Category:** Elasticsearch
**Created:** [May 15, 2018, 8:21am UTC](https://discuss.elastic.co/t/how-to-define-mapping-for-sortable-fields/131882 "2018-05-15T08:21:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jlp1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jlp1/32/6607_2.png) [@jlp1](https://discuss.elastic.co/u/jlp1)
#### Post date: [May 15, 2018, 8:21am UTC](https://discuss.elastic.co/t/how-to-define-mapping-for-sortable-fields/131882/1 "2018-05-15T08:21:04Z")

</div>

I use ES 5.2.2.  
I my document I have some fields used only for sorting. I was not able to find if that is proper mapping.

```
PUT sorting/_mapping/doc
{
  "properties": {
    "name": { - sortable, not searchable
      "type": "keyword"
    },
    "note": {
      "properties": {
        "author": { - sortable, not searchable
          "properties": {
            "name": {
              "type": "keyword"
            }
          }
        },
        "content": { - not sortable, not searchable
          "index": false,
          "type": "text" - why I need to define type when it is not indexed?
        }
      }
    }
  }
}
```

---

<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: [June 12, 2018, 8:21am UTC](https://discuss.elastic.co/t/how-to-define-mapping-for-sortable-fields/131882/2 "2018-06-12T08:21:10Z")

</div>

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