This is an automated email from the ASF dual-hosted git repository.
fortino pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git
The following commit(s) were added to refs/heads/trunk by this push:
new 55bc3e17a6 OAK-11614: ES StatisticalFacets: log search request on
timeout (#2194)
55bc3e17a6 is described below
commit 55bc3e17a6c1fcff3e570935ae028f1977a626a1
Author: Fabrizio Fortino <[email protected]>
AuthorDate: Thu Mar 20 15:14:57 2025 +0100
OAK-11614: ES StatisticalFacets: log search request on timeout (#2194)
---
.../query/async/facets/ElasticStatisticalFacetAsyncProvider.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/async/facets/ElasticStatisticalFacetAsyncProvider.java
b/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/async/facets/ElasticStatisticalFacetAsyncProvider.java
index ae7aa02618..e6be3193ab 100644
---
a/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/async/facets/ElasticStatisticalFacetAsyncProvider.java
+++
b/oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/async/facets/ElasticStatisticalFacetAsyncProvider.java
@@ -65,6 +65,7 @@ public class ElasticStatisticalFacetAsyncProvider implements
ElasticFacetProvide
private final Map<String, List<FulltextIndex.Facet>> allFacets = new
HashMap<>();
private final Map<String, Map<String, Integer>> accessibleFacetCounts =
new ConcurrentHashMap<>();
private Map<String, List<FulltextIndex.Facet>> facets;
+ private final SearchRequest searchRequest;
private final CountDownLatch latch = new CountDownLatch(1);
private int sampled;
private long totalHits;
@@ -79,7 +80,7 @@ public class ElasticStatisticalFacetAsyncProvider implements
ElasticFacetProvide
map(ElasticIndexUtils::fieldName).
collect(Collectors.toSet());
- SearchRequest searchRequest = SearchRequest.of(srb ->
srb.index(indexDefinition.getIndexAlias())
+ this.searchRequest = SearchRequest.of(srb ->
srb.index(indexDefinition.getIndexAlias())
.trackTotalHits(thb -> thb.enabled(true))
.source(SourceConfig.of(scf -> scf.filter(ff ->
ff.includes(FieldNames.PATH).includes(new ArrayList<>(facetFields)))))
.query(Query.of(qb ->
qb.bool(elasticRequestHandler.baseQueryBuilder().build())))
@@ -101,7 +102,7 @@ public class ElasticStatisticalFacetAsyncProvider
implements ElasticFacetProvide
searchFuture.whenCompleteAsync((searchResponse, throwable) -> {
try {
if (throwable != null) {
- LOG.error("Error while retrieving sample documents",
throwable);
+ LOG.error("Error while retrieving sample documents. Search
request: {}", searchRequest, throwable);
} else {
List<Hit<ObjectNode>> searchHits =
searchResponse.hits().hits();
this.sampled = searchHits != null ? searchHits.size() : 0;
@@ -124,6 +125,7 @@ public class ElasticStatisticalFacetAsyncProvider
implements ElasticFacetProvide
try {
boolean completed = latch.await(15, TimeUnit.SECONDS);
if (!completed) {
+ LOG.error("Timed out while waiting for facets. Search request:
{}", searchRequest);
throw new IllegalStateException("Timed out while waiting for
facets");
}
} catch (InterruptedException e) {