# Field that is searchable and sortable (5.2)

**URL:** https://discuss.elastic.co/t/field-that-is-searchable-and-sortable-5-2/99143
**Category:** Elasticsearch
**Created:** [September 1, 2017, 2:35pm UTC](https://discuss.elastic.co/t/field-that-is-searchable-and-sortable-5-2/99143 "2017-09-01T14:35:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![cmalpeli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cmalpeli/32/13250_2.png) [@cmalpeli](https://discuss.elastic.co/u/cmalpeli)
#### Post date: [September 1, 2017, 2:35pm UTC](https://discuss.elastic.co/t/field-that-is-searchable-and-sortable-5-2/99143/1 "2017-09-01T14:35:39Z")

</div>

Hello I am trying to make a text field both searchable and sortable. I have a normalizer that seems to handle the sorting, but it prevents the field from being searchable. Any ideas what I've done wrong - note this is in Searchkick (ruby gem) format:

```
 settings: {
      analysis: {
        normalizer: {
          case_insensitive_sort: {
            type: "custom",
            char_filter: [],
            filter: ['lowercase', 'asciifolding']
          }
        }
      }
    },
    merge_mappings: true, 
    mappings: {
      employer: {
        properties: {
          name: {
            type: 'text',
            fields: {
              sort: {
                type: 'keyword',
                ignore_above: 256,
                normalizer: 'case_insensitive_sort'
              }
            }
          }
        } 
      }
    }
```

---

<div class="post-metadata">

### Author: ![thiago](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thiago/32/32096_2.png) [@thiago](https://discuss.elastic.co/u/thiago)
#### Post date: [September 2, 2017, 12:25pm UTC](https://discuss.elastic.co/t/field-that-is-searchable-and-sortable-5-2/99143/2 "2017-09-02T12:25:51Z")

</div>

A field can not be both sortable and searchable because sorting happens on term level and a searchable field has many terms for a single value.

But the mapping you have presented is the solution for this issue, you have a multi-field in which you would search on field `name` but sort on field `name.sort`. Isn't that what you want?

---

<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: [September 30, 2017, 12:26pm UTC](https://discuss.elastic.co/t/field-that-is-searchable-and-sortable-5-2/99143/3 "2017-09-30T12:26:03Z")

</div>

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