# Is attribute Sort special?

**URL:** <https://discuss.elastic.co/t/is-attribute-sort-special/309166>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [July 8, 2022, 3:59am UTC](https://discuss.elastic.co/t/is-attribute-sort-special/309166 "2022-07-08T03:59:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nevill](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nevill/32/108057_2.png) [@Nevill](https://discuss.elastic.co/u/Nevill)\
**Post date:** [July 8, 2022, 3:59am UTC](https://discuss.elastic.co/t/is-attribute-sort-special/309166/1 "2022-07-08T03:59:17Z")

</div>

I'm previewing AppSearch engine based on existing Elasticsearch indices, got a weird value in `sort` field in search result.  
The way to reproduce it:

1. Put some docs into the index

```auto
POST search-books/_doc
{
  "name": "Elasticsearch Guide",
  "sort": 9,
  "version": 8.2,
  "price": 49
}

POST search-books/_doc
{
  "name": "Kubernetes in Action",
  "sort": 4,
  "version": 1.24,
  "price": 99
}

```

1. Create a AppSearch engine (based on Elasticsearch v8.2.3) named **books-engine** by choosing existing index **search-books**

2. Browse the documents via your Kibana panel (/app/enterprise\_search/app\_search/engines/books-engine/documents)  
or via API

```auto
POST /api/as/v1/engines/books-engine/search
{"query": ""}

```

The return result is

```auto
{
   "meta" : {
      "engine" : {
         "name" : "books-engine",
      },
      "page" : {
           // omit some fields ...
      },
      "request_id" : "fJidGnLUQuCUKbFePr7qOQ"
   },
   "results" : [
      {
         "id" : {
            "raw" : "Ghbh24EBlMLi8pstBRpx"
         },
         "name" : {
            "raw" : "Kubernetes in Action"
         },
         "price" : {
            "raw" : 99
         },
         "version" : {
            "raw" : 1.24
         },
         "sort" : {
            "raw" : [
               1,
               1
            ]
         }
      },
      {
         "id" : {
            "raw" : "n9Lg24EBzZcm6zCt_OEm"
         },
         "name" : {
            "raw" : "Elasticsearch Guide"
         },
         "version" : {
            "raw" : 8.2
         },
         "price" : {
            "raw" : 49
         },
         "sort" : {
            "raw" : [
               1,
               0
            ]
         }
      }
   ]
}

```

As you can see, the **sort.raw** value is an array instead of a number.  
Can someone explain why this happened and how to avoid it?

---

<div class="post-metadata">

**Author:** ![ioana.tagirta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ioana.tagirta/32/46368_2.png) [@ioana.tagirta](https://discuss.elastic.co/u/ioana.tagirta)\
**Post date:** [July 11, 2022, 9:14am UTC](https://discuss.elastic.co/t/is-attribute-sort-special/309166/2 "2022-07-11T09:14:48Z")

</div>

Hi Nevill,

Thank you for reporting this issue - we managed to replicate it.  
The Elasticsearch index engines feature is under technical preview, issue reports like this one help us make it better.  
Unfortunately there is no workaround for it in the current released version which at the moment is 8.3.  
I would advise that for now, to use a different field name instead of `sort`.

---

<div class="post-metadata">

**Author:** ![Nevill](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nevill/32/108057_2.png) [@Nevill](https://discuss.elastic.co/u/Nevill)\
**Post date:** [July 12, 2022, 3:41am UTC](https://discuss.elastic.co/t/is-attribute-sort-special/309166/3 "2022-07-12T03:41:38Z")

</div>

Thanks for your reply Ioana, wish this can be fixed soon.  
I am about to avoid using `sort` to skip the issue.

---

<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 9, 2022, 3:41am UTC](https://discuss.elastic.co/t/is-attribute-sort-special/309166/4 "2022-08-09T03:41:53Z")

</div>

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