# Index sorting in rollover request not supported?

**URL:** <https://discuss.elastic.co/t/index-sorting-in-rollover-request-not-supported/197430>\
**Category:** Elasticsearch\
**Created:** [August 30, 2019, 1:37am UTC](https://discuss.elastic.co/t/index-sorting-in-rollover-request-not-supported/197430 "2019-08-30T01:37:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![linkerc](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@linkerc](https://discuss.elastic.co/u/linkerc)\
**Post date:** [August 30, 2019, 1:37am UTC](https://discuss.elastic.co/t/index-sorting-in-rollover-request-not-supported/197430/1 "2019-08-30T01:37:24Z")

</div>

ES 7.3.0  
I'm trying to issue rollover command with index sorting. But I'm getting status 400 with "reason": "unknown index sort field:[ts]"

This is my payload:

```
POST test/_rollover
{
    "conditions": {
    "max_size": "0gb"
  },
  "settings": {
    "index.number_of_shards": 2,
    "index.sort.field": "ts",
    "index.sort.order": "desc"
  },
  "mappings": {
    "properties": {
      "ts": {
        "type": "date"
      }
    }
  }
}

```

When the condition is not met, then it just returns good status with "conditions" rc set to false.  
But if the condition is met (notice I use 0gb to test empty index), I'm getting the above error code.  
If I remove the sort.field and sort.order in "settings", then the rollover api creates the new index.

---

<div class="post-metadata">

**Author:** ![linkerc](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@linkerc](https://discuss.elastic.co/u/linkerc)\
**Post date:** [August 30, 2019, 1:52am UTC](https://discuss.elastic.co/t/index-sorting-in-rollover-request-not-supported/197430/2 "2019-08-30T01:52:12Z")

</div>

It looks like the "mappings" field is not applied for the rollover API.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 30, 2019, 8:29am UTC](https://discuss.elastic.co/t/index-sorting-in-rollover-request-not-supported/197430/3 "2019-08-30T08:29:08Z")

</div>

you may want to take a look at index templates to always apply some mapping when a certain index gets created.

See [https://www.elastic.co/guide/en/elasticsearch/reference/7.3/indices-templates.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/indices-templates.html)

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 30, 2019, 8:32am UTC](https://discuss.elastic.co/t/index-sorting-in-rollover-request-not-supported/197430/4 "2019-08-30T08:32:09Z")

</div>

Actually I justed tested your example on 7.3.1 and it works as expected.

Can you show a full recreation including all the responses?

---

<div class="post-metadata">

**Author:** ![linkerc](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@linkerc](https://discuss.elastic.co/u/linkerc)\
**Post date:** [August 30, 2019, 9:21pm UTC](https://discuss.elastic.co/t/index-sorting-in-rollover-request-not-supported/197430/5 "2019-08-30T21:21:16Z")

</div>

```
 PUT test-000001
    {
      "aliases": {
      "test": {}
      }
    }

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/1/41130d24332b6d2d82fcc8e534d187a3bbb40b9c.png)

```
POST test/_rollover
{
  "conditions": {
    "max_size": "0gb"
  },
  "mappings": {
    "properties": {
      "ts": {
        "type": "date"
      }
    }
  },
  "settings": {
    "index.number_of_shards": 2,
    "index.sort.field": "ts",
    "index.sort.order": "desc"
  }
}

```

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/4/649927217e9a69f24b0e6e28527ba55570761a3b.png)

I might give 7.3.1 a try.

---

<div class="post-metadata">

**Author:** ![linkerc](https://avatars.discourse-cdn.com/v4/letter/l/13edae/32.png) [@linkerc](https://discuss.elastic.co/u/linkerc)\
**Post date:** [August 30, 2019, 9:43pm UTC](https://discuss.elastic.co/t/index-sorting-in-rollover-request-not-supported/197430/6 "2019-08-30T21:43:20Z")

</div>

Yup. Just confirmed 7.3.1 works.

---

<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 27, 2019, 9:43pm UTC](https://discuss.elastic.co/t/index-sorting-in-rollover-request-not-supported/197430/7 "2019-09-27T21:43:24Z")

</div>

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