- 🇨🇦Canada mparker17 UTC-4
In 📌 Investigate search_api_opensearch as base for elasticsearch_connector Fixed , we made a bunch of changes to how the 8.0.x version of this module works. I manually tested it with Search API Autocomplete → and didn't receive any errors like this.
May we trouble you to try out the latest 8.0.x-dev release → and see if it meets your needs? If it does not, may we trouble you to change this issue's "Status" back to "Needs work"?
(I'm cleaning up issues in the 8.0.x-dev branch as part of a big review of open issues for 🌱 Plan for 8.0.0-alpha release Active : thank you for your patience with me!)
- 🇮🇳India mikebhatti
I use
Elasticsearch Connector: 8.x-7.0-alpha4
Drupal 10.2.3The search page is returning this error:
Elasticsearch\Common\Exceptions\BadRequest400Exception: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [type] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"elasticsearch_index_ccsa_index","node":"anDpZ9_cTWyXZt6Y_yu7fw","reason":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [type] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}],"caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [type] in order to load field data by uninverting the inverted index. Note that this can use significant memory.","caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [type] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}},"status":400} in Elasticsearch\Connections\Connection->process4xxError() (line 693 of /srv/ccsa-website-drupal/src/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php).
I tried the patch given above but still getting the same error.
- 🇮🇳India mikebhatti
I'm getting this error on search page. I'm using Drupal 10.2.3 and Elasticsearch Connector 8.x-7.0-alpha4.
Elasticsearch\Common\Exceptions\BadRequest400Exception: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [type] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"elasticsearch_index_ccsa_index","node":"anDpZ9_cTWyXZt6Y_yu7fw","reason":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [type] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}],"caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [type] in order to load field data by uninverting the inverted index. Note that this can use significant memory.","caused_by":{"type":"illegal_argument_exception","reason":"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [type] in order to load field data by uninverting the inverted index. Note that this can use significant memory."}}},"status":400} in Elasticsearch\Connections\Connection->process4xxError() (line 693 of /srv/ccsa-website-drupal/src/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php).
I tried the patch above but it doesn't work.
- Status changed to Active
8 months ago 2:35pm 5 April 2024 - 🇨🇦Canada mparker17 UTC-4
I'll change the ticket to Version 8.x-7.x-dev, and Status back to Active.
- 🇮🇳India keshavv India
I am getting the same error today on Drupal 10.2.6 and not able to resolve it.
- 🇧🇪Belgium robindh
I encountered a very similar issue, but with elasticsearch connector 8.x-7.0-alpha4. This actual problem was my mapping not being imported.
When navigating to /admin/config/search/search-api/index/myindex/fields and saving the form, I noticed this error:
Failed to parse mapping [_doc]: unknown parameter [fielddata] on mapper [myfield] of type [keyword]
At this point my index mapping is basically empty. When executing a query the response is:
Text fields are not optimised for operations that require per-document field data like aggregations and sorting ...
Presumably, this happens because elasticsearch doesn't map text fields as fielddata by default.
Fixed it by only adding fielddata mapping to text fields, since other fields don't support it.Attaching a patch for version 8.x-7.0-alpha4