Skip to content
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

terms aggregation doesn't support excluding values #1085

Closed
nablaone opened this issue Dec 9, 2024 · 1 comment
Closed

terms aggregation doesn't support excluding values #1085

nablaone opened this issue Dec 9, 2024 · 1 comment

Comments

@nablaone
Copy link
Member

nablaone commented Dec 9, 2024

I've tried to exclude some values from the "pie" chart, but they are still presented.

Here is a picture:

Screenshot 2024-12-09 at 15 29 39

Kibana made following query:

{
  "_source": {
    "excludes": []
  },
  "aggs": {
    "0": {
      "terms": {
        "exclude": [
          "A"
        ],
        "field": "foo.keyword",
        "order": {
          "_count": "desc"
        },
        "shard_size": 25,
        "size": 3
      }
    }
  },
  "fields": [
    {
      "field": "@timestamp",
      "format": "date_time"
    }
  ],

// "query" part is removed 
  "track_total_hits": true
}

Elastic returns:

... 
"aggregations": {
    "0": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "key": "b",
          "doc_count": 1
        },
        {
          "key": "c",
          "doc_count": 1
        }
      ]
    }
  }
...

Quesma returns:

...
  "aggregations": {
    "0": {
      "buckets": [
        {
          "doc_count": 1,
          "key": "A"
        },
        {
          "doc_count": 1,
          "key": "b"
        },
        {
          "doc_count": 1,
          "key": "c"
        }
      ],
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0
    }
  }
...
github-merge-queue bot pushed a commit that referenced this issue Dec 28, 2024
#1085

TODO (next PRs):
* `include` parameter can probably be quite easily handled the same way
* our regex translator is pretty basic, it requires tests + possibly a
better implementation

Issue from the issue works fine now:
<img width="1420" alt="Screenshot 2024-12-27 at 01 30 32"
src="https://github.com/user-attachments/assets/2b943135-7d10-4dd7-b418-600cd3a2632c"
/>
<img width="1416" alt="Screenshot 2024-12-27 at 01 32 17"
src="https://github.com/user-attachments/assets/39b82688-1816-42b9-8823-77a93af6e108"
/>
@trzysiek
Copy link
Member

trzysiek commented Dec 28, 2024

Fixed by #1140.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants