Error with facets "Expected [START_OBJECT] under [filter], but got a [START_ARRAY]..."

Created on 5 August 2024, 3 months ago
Updated 13 September 2024, 2 months ago

Problem/Motivation

When using facetted search view, selecting multiple facet values leads to an error :

400 Bad Request: {"error":{"root_cause":[{"type":"parsing_exception","reason":"Expected [START_OBJECT] under [filter], but got a [START_ARRAY] in [variation_langcode_filtered]","line":1,"col":473}],"type":"parsing_exception","reason":"Expected [START_OBJECT] under [filter], but got a [START_ARRAY] in [variation_langcode_filtered]","line":1,"col":473},"status":400}

Steps to reproduce

Create a view with at least two facets, select one value in each facet, see the error.
Error can be seen in "Drupal\elasticsearch_connector\SearchAPI\Query\FacetParamBuilder" on line 117.

Proposed resolution

Wrap the filter into additional layers as seed on https://stackoverflow.com/a/48040256/1756667

🐛 Bug report
Status

Postponed: needs info

Version

8.0

Component

Code

Created by

🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Renrhaf
  • Status changed to Needs review 3 months ago
  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜
  • Pipeline finished with Failed
    3 months ago
    Total: 180s
    #244498
  • Status changed to Needs work 3 months ago
  • 🇫🇮Finland sokru

    Thanks for reporting the bug. Changed the status to "Needs work" since the automated tests (or the fix) needs changes to pass the pipeline. I added this issue to as "must have" for 🌱 Plan for 8.0.0-beta release Active .

  • Status changed to Postponed: needs info 3 months ago
  • 🇫🇮Finland sokru

    I tried to replicate the issue with latest 8.0.x branch, I created a view search page and added two facets (taxonomy term and node-id) but unfortunately I was not able to get any error message. Would you be able to replicate the error with fresh site and latest version of Elasticsearch connector 8.0.x module?

  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜

    Hi Sokru, thanks for the review I'll give it a try asap and report back

  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜

    I'm still having the issue with the 8.0.x-dev version :
    400 Bad Request: {"error":{"root_cause":[{"type":"parsing_exception","reason":"Expected [START_OBJECT] under [filter], but got a [START_ARRAY] in [product_language_filtered]","line":1,"col":542}],"type":"parsing_exception","reason":"Expected [START_OBJECT] under [filter], but got a [START_ARRAY] in [product_language_filtered]","line":1,"col":542},"status":400}

    See xDebug of the variable when the problem occurs : https://ibb.co/891yjXR

Production build 0.71.5 2024