Skip to content

Allow null from/to in range aggregation #2863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2024
Merged

Allow null from/to in range aggregation #2863

merged 1 commit into from
Sep 6, 2024

Conversation

pquentin
Copy link
Member

@pquentin pquentin commented Sep 6, 2024

This fixes the following YAML test in the Search API:

{
  "api": "search",
  "file": "/test/free/aggregations/range.yml",
  "name": "Null to and from",
  "origin": "yaml",
  "request": {
    "args": {
      "body": {
        "aggs": {
          "double_range": {
            "range": {
              "field": "double",
              "ranges": [
                {
                  "from": null,
                  "to": 50
                },
                {
                  "from": 50,
                  "to": 150
                },
                {
                  "from": 150,
                  "to": null
                }
              ]
            }
          }
        },
        "size": 0
      },
      "index": "test",
      "typed_keys": true
    }
  },
  "response": {
    "headers": {
      "content-encoding": "gzip",
      "content-type": "application/json",
      "transfer-encoding": "chunked",
      "x-elastic-product": "Elasticsearch"
    },
    "payload": {
      "_shards": {
        "failed": 0,
        "skipped": 0,
        "successful": 1,
        "total": 1
      },
      "aggregations": {
        "range#double_range": {
          "buckets": [
            {
              "doc_count": 1,
              "key": "*-50.0",
              "to": 50
            },
            {
              "doc_count": 2,
              "from": 50,
              "key": "50.0-150.0",
              "to": 150
            },
            {
              "doc_count": 0,
              "from": 150,
              "key": "150.0-*"
            }
          ]
        }
      },
      "hits": {
        "hits": [
        ],
        "max_score": null,
        "total": {
          "relation": "eq",
          "value": 4
        }
      },
      "timed_out": false,
      "took": 2
    },
    "statusCode": 200
  }
}

Copy link
Member

@flobernd flobernd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well!

@pquentin pquentin merged commit 24d0e0f into main Sep 6, 2024
6 checks passed
@pquentin pquentin deleted the null-ranges branch September 6, 2024 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants