Try our conversational search powered by Generative AI!

"Bad Request" when using nested queries for facets


I'm having issues getting nested queries and facets to work on my Commerce catalog content types, specifically a product content and a variation content.

I'm running Find, Commerce 9.8.1, and CMS 9.6.1.

The issue

When I try to get results from Find, I'm getting a "(400) Bad Request" (I've tried to cut out unnecessary error data):

SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; 
Parse Failure [Failed to parse source 
Parse Failure [facet nested path [MyNestedObjects] not found]]; }

The code

Based on the documentation (, I think I have everything configured and developed correctly.

This is done in an initialization module:

SearchClient.Instance.Conventions.NestedConventions.ForType().Add(content => content.MyNestedObjects);
SearchClient.Instance.Conventions.NestedConventions.ForType().Add(content => content.MyNestedObjects);

On the content types, I have the properties as such:

public IEnumerable MyNestedObjects
        var listOfNestedObjects = new List();
        return listOfNestedObjects;

And I'm setting up the search and facets like this:

    .InFields(x => x.DisplayName)
    .TermsFacetFor(x => x.MyNestedObjects, x => x.NestedObjectProperty);

And an example of the indexed data on an instance of the content looks like:

"MyNestedObjects$$nested": [
    "$type": "MyProject.Objects.NestedObject, MyProject",
    "___types": [
    "NestedObjectProperty$$string": "Some Value"

I have also tried this all as a function call on the content types, making sure to IncludeField() the function call, but the result is the same.

So everything looks to be set up correctly, right? What gives?

Edited, May 04, 2016 21:41

Looks good from my point of view I'm sad to say :)

Support issue?

May 04, 2016 23:42

This appears to be a bug after reproducing this in a local alloy environment with developer index. Going to submit a bug report to the Find team.

May 06, 2016 1:01

Hi Chris, 

Have you raised support ticket? I am currently facing the same issue, after upgrade from EPi.Find to latest. The same query was working before , and now stopped working. I guess there must be some internal breaking changes that make it happen :(

Current installed version as followings

<package id="EPiServer.Find" version="" targetFramework="net46" />
<package id="EPiServer.Find.Cms" version="" targetFramework="net46" />
<package id="EPiServer.Find.Commerce" version="9.5.3" targetFramework="net46" />
<package id="EPiServer.Find.Framework" version="" targetFramework="net46" />

Edited, May 10, 2016 15:01

A support ticket has been raised. I've been working with Richly to verify the issue, and the Find team is aware of the issue. It actually sounds like this issue was previously reported, so now they have two tickets. :)

A workaround has been suggested until the bug can be fixed and released, and I'm working on testing that workaround this week. If I get things working, I'll update this thread.

May 10, 2016 16:41

I found the issue in my solution. 

After upgrade to the latest version, there are a few find commerce extension methods caused my query stopped working  as shown below

return query.FilterOnCurrentMarkeet()

//.FilterPriceAvailableForCurrentCurrency() ?? Internal breaking changes??
//.FilterPriceAvailableForCurrentMarket() ?? EPiFind Internal breaking changes??

May 12, 2016 7:46

code monkey: when upgrading Commerce you have to reindex the site to make the queries work (there will be a release note comming regarding this).


May 20, 2016 9:30

Hi Henrik

That's what I did,and found out those issues.

After upgrade, I first ran reindex job and it's too slow. I then went to epi find manage, clear the index and built index from scratch, when indexing completed, my most complex query stopped working as I mentioned in my last reply. It's still broken at the moment with those two price extension methods.



May 20, 2016 11:45

code monkey: are you getting 'Bad Request' errors? Can you register a support case for that together with the indexname you are using?

May 23, 2016 8:37

Just a follow-up to this thread... Episerver Find 12 now provides more detailed error messages. After upgrading to Find 12, I was able to see where my issue was originating (it was much deeper in the code).

Jun 21, 2016 17:00
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.