We have broker queries running OK on Sites 9.5 and DXA 2.9, after upgrade to Sites 10 and DXA 2.3 the queries return empty result with the following error logged in cd_client.log
[Tridion.ContentDelivery.DynamicContent.Query.Query.ExecuteEntityQuery] - Problem executing entity query.
EXCEPTION:
Sdl.Web.Delivery.Service.ServiceQueryException: Failed to execute query ---> Microsoft.OData.Client.DataServiceQueryException: An error occurred while processing this request. ---> Microsoft.OData.Client.DataServiceClientException: <html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
</body>
</html>
at Microsoft.OData.Client.QueryResult.ExecuteQuery()
at Microsoft.OData.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
--- End of inner exception stack trace ---
at Microsoft.OData.Client.DataServiceRequest.Execute[TElement](DataServiceContext context, QueryComponents queryComponents)
at Microsoft.OData.Client.DataServiceContext.InnerSynchExecute[TElement](Uri requestUri, String httpMethod, Nullable`1 singleResult, OperationParameter[] operationParameters)
at Microsoft.OData.Client.DataServiceContext.Execute[TElement](Uri requestUri, String httpMethod, OperationParameter[] operationParameters)
at Sdl.Web.Delivery.Service.ODataV4Service.<>c__DisplayClass19_1`1.<Execute>b__1()
at Sdl.Web.Delivery.Caching.CacheHandlers.DefaultMemCache.DefaultMemCacheHandler`1.SetOrGetExisting(String key, String region, Func`1 valueFactory, CacheItemPolicy cacheItemPolicy)
at Sdl.Web.Delivery.Service.ODataV4Service.<>c__DisplayClass19_0`1.<Execute>b__0()
--- End of inner exception stack trace ---
at Sdl.Web.Delivery.Service.AbstractODataService.HandleHttpResponseCode(Exception e, Int32 statusCode)
at Sdl.Web.Delivery.Service.AbstractODataService.HandleException(Exception e)
at Sdl.Web.Delivery.Service.ODataV4Service.<>c__DisplayClass19_0`1.<Execute>b__0()
at Sdl.Web.Delivery.Service.Utils.PerformRetry[T](Func`1 block, Int32 retryCount)
at Sdl.Web.Delivery.Service.Utils.Retry[T](Func`1 block, Int32 retryCount, Boolean locking)
at Sdl.Web.Delivery.Broker.Querying.QueryImpl.DoExecuteEntityQuery(ODataV4ClientAction action)
at Sdl.Web.Delivery.Caching.CacheHandlers.DefaultMemCache.DefaultMemCacheHandler`1.SetOrGetExisting(String key, String region, Func`1 valueFactory, CacheItemPolicy cacheItemPolicy)
at Sdl.Web.Delivery.Broker.Querying.QueryImpl.ExecuteEntityQuery()
Example query
List<Criteria> children = new List<Criteria>();
children.Add(new ItemTypeCriteria(itemType));
children.Add(new PublicationCriteria(publicationId));
children.Add(new PageURLCriteria($"{structureGroupPath}%", Criteria.Like));
Criteria prCriteria = new AndCriteria(children.ToArray());
Tridion.ContentDelivery.DynamicContent.Query.Query query = new Tridion.ContentDelivery.DynamicContent.Query.Query(prCriteria);
SortParameter sortParameter = new SortParameter(SortParameter.ItemTitle, SortParameter.Ascending);
query.AddSorting(sortParameter);
IItem[] results = query.ExecuteEntityQuery();