Skip to content

Add maxValueCount to DocValuesSkipper metadata #15794

Closed

Description

@romseygeek

Description

Currently, if a consumer of a numeric or ordinal-based docvalues iterator wants to know if the field is multivalued, then they need to access it via DocValues.getSortedXXX and then check to see if the returned iterator can be unwrapped to a singleton. This is fragile, and not necessarily supported by Codecs. We could build more consistent checks by storing a global maxValueCount entry on DocValuesSkipper. A singleton check can then be done by seeing if the global maxValueCount is equal to 1.

Activity

  1. martijnvg commented on Mar 4, 2026

    @martijnvg
    Contributor

    A singleton check can then be done by seeing if the global maxValueCount is equal to 1.

    Would it also make sense to also support maxValueCount at the doc value skipper entry level? Then queries know from minDocId to maxDocId are single valued or not?

  2. gaobinlong commented on Mar 6, 2026

    @gaobinlong
    Contributor

    Awesome, we really want this feature, in our use case, we want to know if a docvalues field is multi-valued, then convert the same string field's format to array for each hit doc in the search response.

  3. sgup432 commented on Mar 6, 2026

    @sgup432
    Contributor

    then they need to access it via DocValues.getSortedXXX and then check to see if the returned iterator can be unwrapped to a singleton.

    I also found this to be a somewhat hacky way of determining whether a field is multi-valued when I first looked at it.
    So makes sense to add maxValueCount entry on DocValuesSkipper.

    I can pick this up until unless someone is already working on it.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions