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

Created on 5 August 2024, 7 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

Active

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 7 months ago
  • 🇫🇷France Renrhaf 📍 Strasbourg 🐦🦜
  • Pipeline finished with Failed
    7 months ago
    Total: 180s
    #244498
  • Status changed to Needs work 7 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 6 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

  • Status changed to Needs work 3 months ago
  • 🇧🇾Belarus dewalt

    Still having the issue, docker image docker.elastic.co/elasticsearch/elasticsearch:8.14.3

    Version: 8.14.3, Build: docker/d55f984299e0e88dee72ebd8255f7ff130859ad0/2024-07-07T22:04:49.882652950Z, JVM: 22.0.1
    

    Drupal 10.3.2, module version 8.0.x-dev

    2 facets, string (list string field) and entity reference, some combination are working, but most of combinations leads too:

    {"error":{"root_cause":[{"type":"parsing_exception","reason":"Expected [START_OBJECT] under [filter], but got a [START_ARRAY] in [field_content_reference_filtered]","line":1,"col":358}],"type":"parsing_exception","reason":"Expected [START_OBJECT] under [filter], but got a [START_ARRAY] in [field_content_reference_filtered]","line":1,"col":358},"status":400}
    
Production build 0.71.5 2024