Skip to content

[BUG] Sorting not working well on scaled_float fields when using query #17833

Open
@AhmedEnnaime

Description

@AhmedEnnaime

Description

I have this field in my opensearch index

"amount": {
  "type": "scaled_float",
  "scaling_factor": 10000
},

when i try to run a query to get my documents sorted by the amount the documents are not well sorted

GET myIndex/_search
{
  "_source": ["amount"],
  "query": {
    "match_all": {}
  },
  "sort": [
    {
      "amount": {
        "order": "desc"
      }
    }
  ],
  "from": 11,
  "size": 21
}

I saw an opened bug that kinda talks about the same issue if there's any news about it can you please let me know about it

Related similar bug: #12433

Related component

Search

To Reproduce

Create an index with a scaled_float field and add some large values and try to execute a normal search query that orders by that field and see if the results are well sorted or not. Please try to add a lot of values to reproduce it.

Expected behavior

Normally the documents should be sorted well either in a descending or ascending way.

Additional Details

Host/Environment :

  • OS: [Linux Ubuntu 24.04]
  • OpenSearch version: 2.19.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    SearchSearch query, autocomplete ...etcbugSomething isn't working

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions