Skip to content

Conversation

@chamchi00800
Copy link

@chamchi00800 chamchi00800 commented Jan 25, 2026

Description

implement multivalue_doc_count aggregation.
The multivalue_doc_count function returns the number of documents that have two or more values.

  1. Implemented with reference to the mentioned value_count.
  2. exlclude precomputed logic in this PR.
    exclude precomputeLearUsingStarTree method because it is not registered in starTree,
    and the PR seems to be getting too huge.

Related Issues

Resolves #20329

test

(1) Unit test : I wrote a test for the aggregator in MultiValueDocCountAggregatorTest

(2) Run locally and test with real curl

step1 create index and insert documents

curl -X PUT "localhost:9200/products?pretty" -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "properties": {
      "categories": {
        "type": "keyword"
      }
    }
  }
}'

curl -X POST "localhost:9200/products/_bulk?refresh=true&pretty" -H 'Content-Type: application/json' -d'
{"index": {"_id": "1"}}
{"categories": ["Electronics", "Computers"]}
{"index": {"_id": "2"}}
{"categories": ["Books"]}
{"index": {"_id": "3"}}
{"categories": ["Electronics", "Phones", "Accessories"]}
{"index": {"_id": "4"}}
{"categories": ["Clothing"]}
'

step2 aggregation by multivalue_doc_count
image

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 25, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added enhancement Enhancement or improvement to existing feature or request Search:Aggregations labels Jan 25, 2026
@github-actions
Copy link
Contributor

❌ Gradle check result for a1c973e: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: minsu kim <35398494+chamchi00800@users.noreply.github.com>
@chamchi00800 chamchi00800 force-pushed the feature/multivalue-aggregation branch from d1d38f9 to f60f066 Compare January 25, 2026 08:15
@github-actions
Copy link
Contributor

❌ Gradle check result for f60f066: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement or improvement to existing feature or request Search:Aggregations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Implement "multivalue_doc_count" aggregation for counting documents with multi-valued fields

1 participant