Details
-
Bug
-
Resolution: Fixed
-
Major
-
14.4
-
None
-
Unknown
-
N/A
-
N/A
-
Description
DataManager#searchInstalls(String) is documented as returning all matching pings, but DefaultDataManager never sets the search request's size, so Elasticsearch applies its default of 10 hits. The method therefore returns at most 10 pings, however many the query matches.
The javadoc (DataManager.java):
* @return the parsed JSON result coming from Elastic Search, as a list of {@link Ping} object. Passing an empty * or null json string results in returning all data found in the index (i.e no query constraint)
The implementation (DefaultDataManager.java):
SearchRequest request = SearchRequest.of(s -> {
s.index(ElasticsearchClientManager.INDEX);
return applyQuery(s, jsonQuery);
});
There is no size(...) call, and there has never been one: the method has been this way since it was introduced in 14.4RC1 (commit 7a8d0ea6e71, 2022-05-10).
Note that countInstalls and the two 18.8.0RC1 methods (countDistinctInstalls, countDistinctInstallsByExtension) are unaffected — they aggregate rather than return hits.
This also makes the documentation wrong. Active Installs Script Service says "Pass an empty string to select every ping", which is true for the counting methods but not for searchInstalls.
What needs deciding:
- set an explicit size (and, for result sets that can be large, paginate with search_after or a PIT rather than raising the cap indefinitely); or
- keep a cap deliberately, and fix the javadoc and the reference page to state it.
Found while documenting XWIKI-24710 for the 18.8.0RC1 release notes.