Skip to content

[BUG] match query on a scaled_float property no longer matches for some values #12433

Open
@marko-bekhta

Description

@marko-bekhta

Describe the bug

When an index contains a scaled_float field, indexing a document with some (large) value and then running a match query for that same value may not return any hits in OpenSearch 2.12.0, whereas it used to in all prior versions.

Related component

Search

To Reproduce

  1. Create a simple index containing a scaled_float field as:
PUT http://localhost:9200/test-bigdecimal-index-000001
Content-Type: application/json

{
  "mappings": {
    "dynamic": "strict",
    "properties": {
      "field0_BigDecimal": {
        "type": "scaled_float",
        "doc_values": false,
        "scaling_factor": 100.0
      }
    }
  }
}
  1. Add a document with a large value:
POST http://localhost:9200/test-bigdecimal-index-000001/_doc/1
Content-Type: application/json

{
  "field0_BigDecimal": 92233720368547750
}
  1. Try to run a match query for that same value we've indexed:
POST http://localhost:9200/test-bigdecimal-index-000001/_search
Content-Type: application/json

{
  "query": {
    "match": {
      "field0_BigDecimal": {
        "query": "92233720368547750"
      }
    }
  }
}
  1. Results in no matches:
{
  "took": 8,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 0,
      "relation": "eq"
    },
    "max_score": null,
    "hits": []
  }
}

Expected behavior

It's expected to get the document we've indexed as in previous versions of OpenSearch:

{
  "took": 1,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 1,
      "relation": "eq"
    },
    "max_score": 1.0,
    "hits": [
      {
        "_index": "test-bigdecimal-index-000001",
        "_id": "1",
        "_score": 1.0,
        "_source": {
          "field0_BigDecimal": 92233720368547750
        }
      }
    ]
  }
}

Additional Details

Plugins
eabfec3b01ea opensearch-alerting 2.12.0.0
eabfec3b01ea opensearch-anomaly-detection 2.12.0.0
eabfec3b01ea opensearch-asynchronous-search 2.12.0.0
eabfec3b01ea opensearch-cross-cluster-replication 2.12.0.0
eabfec3b01ea opensearch-custom-codecs 2.12.0.0
eabfec3b01ea opensearch-flow-framework 2.12.0.0
eabfec3b01ea opensearch-geospatial 2.12.0.0
eabfec3b01ea opensearch-index-management 2.12.0.0
eabfec3b01ea opensearch-job-scheduler 2.12.0.0
eabfec3b01ea opensearch-knn 2.12.0.0
eabfec3b01ea opensearch-ml 2.12.0.0
eabfec3b01ea opensearch-neural-search 2.12.0.0
eabfec3b01ea opensearch-notifications 2.12.0.0
eabfec3b01ea opensearch-notifications-core 2.12.0.0
eabfec3b01ea opensearch-observability 2.12.0.0
eabfec3b01ea opensearch-performance-analyzer 2.12.0.0
eabfec3b01ea opensearch-reports-scheduler 2.12.0.0
eabfec3b01ea opensearch-security 2.12.0.0
eabfec3b01ea opensearch-security-analytics 2.12.0.0
eabfec3b01ea opensearch-skills 2.12.0.0
eabfec3b01ea opensearch-sql 2.12.0.0

Host/Environment:
Linux Fedora 6.7.4-200.fc39.x86_64

Additional context
OpenSearch is started from an official docker image as:

docker run -it -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "plugins.security.disabled=true" -e "OPENSEARCH_INITIAL_ADMIN_PASSWORD=Actua11yStrongPassword" opensearchproject/opensearch:2.12.0

Metadata

Metadata

Labels

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

Type

No type

Projects

Status

Later (6 months plus)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions