0

I'm getting a 400 when trying to search for a nested attribute facet field

e.g. a post request to the following url will give me

http://xxx-dsn.algolia.net/1/indexes/index_name/facets/work_experience.company/query

{"message":"Cannot search in `work_experience.company` attribute, you need to add `searchable(work_experience.company)` to attributeForFaceting.","status":400}

However a non nested attribute facet search works

http://xxx-dsn.algolia.net/1/indexes/index_name/facets/language_names/query

I've double checked and the facets are correctly added to attributes for faceting.

Any help would be appreciated.

Thanks!

xiao
  • 1,718
  • 4
  • 23
  • 31
  • What do you mean by "json facet" ? Are you speaking about a nested attribute? – redox Dec 20 '16 at 17:47
  • Sorry bad terminlogy I made up :). so `{"language_names": ['english', 'spanish'], "work_experience": [{"company": "algolia"}]}` `language_names` would be a non nested facet field, and `work_experience.company` would be the nested facet field. – xiao Dec 20 '16 at 17:51
  • Just tested it, works on my side. Do you confirm you added `searchable(work_experience.company)` to your `attributesForFaceting` index setting? – redox Dec 21 '16 at 08:35
  • Yes, I've checked the algolia.com display settings page, and my local settings, and they are both added. I can see all the facets + counts on the algolia dashboard too. – xiao Dec 21 '16 at 15:28
  • Okay It works if I wrap `searchable()` around the nested attribute. I must say that is confusing and inconsistent with the rest of the non nested facets. Any reason it must be wrapped in a `searchable()`? – xiao Dec 21 '16 at 15:55

0 Answers0