Description
Describe the bug
Lucene 10 makes it illegal to call SortedSetDocValues#nextOrd() more than#docValueCount() times for the currently-positioned doc.
https://github.com/apache/lucene/blob/e7f9bc837e419672d9bfc829d01e643df667e9d4/lucene/core/src/java/org/apache/lucene/index/SortedSetDocValues.java#L36
Remove all occurrences of SSDV.nextOrd() != NO_MORE_DOCS
and replace with use of SSDV.docValuesCount() like in #17626
I consider this as a blocker to OpenSearch 3.0 which is making use of lucene 10.
Related component
Search
To Reproduce
This was causing flakiness in MultiOrdinalsTests as encountered in PR #17446 with failure https://build.ci.opensearch.org/job/gradle-check/54686/testReport/junit/org.opensearch.index.fielddata.ordinals/MultiOrdinalsTests/testRandomValues/
Expected behavior
Remove all occurrences of SSDV.nextOrd() != NO_MORE_DOCS
and replace with use of SSDV.docValuesCount()
Additional Details
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
- OS: [e.g. iOS]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.