10up / ElasticPress

A fast and flexible search and query engine for WordPress.
https://elasticpress.io
GNU General Public License v2.0
1.24k stars 312 forks source link

BUG: failed search requests by missing body (metabox context) #3789

Closed APCgit closed 9 months ago

APCgit commented 9 months ago

Describe the bug

On the Status Report backend page I get from time to time failed queries with this url structure: https://mywebsite.com/?post=258265&action=edit&meta-box-loader=1&meta-box-loader-nonce=0286ed8822&_locale=user

The status report noticed the following json error: { "error": { "root_cause": [ { "type": "parse_exception", "reason": "request body is required" } ], "type": "parse_exception", "reason": "request body is required" }, "status": 400 }

Sadly the failed queries are random reported. Within 24h we get up to 4 to 5 failed ones. The actual elasticsearch query is structured like this:

POST http://localhost:9200/%INDEX_LIST_NAME%/_bulk

Steps to Reproduce

unknown (random)

Screenshots, screen recording, code snippet

No response

Environment information

WordPress and ElasticPress information

Domain and index name replaced:

Failed Queries

https://www.mywebsite.com/?post=255860&action=edit&meta-box-loader=1&meta-box-loader-nonce=7bd371f99c&_locale=user (2023-12-12 09:18:07)

error: request body is required recommended_solution: We did not recognize this error. Please consider opening a GitHub Issue so we can add it to our list of supported errors. es_req: POST http://localhost:9200/%INDEX_NAME%/_bulk request_id: 45855b48c56d41aeaee8383e98a2535c query_time: 0.91409683227539 wp_args: array ( ) status_code: 400 body: result: array ( 'error' => array ( 'root_cause' => array ( 0 => array ( 'type' => 'parse_exception', 'reason' => 'request body is required', ), ), 'type' => 'parse_exception', 'reason' => 'request body is required', ), 'status' => 400, )

https://www.mywebsite.com (2023-12-12 09:17:22)

error: request body is required recommended_solution: We did not recognize this error. Please consider opening a GitHub Issue so we can add it to our list of supported errors. es_req: POST http://localhost:9200/%INDEX_NAME%/_bulk request_id: dc2285d4aa104c268893172e321410a9 query_time: 0.71477890014648 wp_args: array ( ) status_code: 400 body: result: array ( 'error' => array ( 'root_cause' => array ( 0 => array ( 'type' => 'parse_exception', 'reason' => 'request body is required', ), ), 'type' => 'parse_exception', 'reason' => 'request body is required', ), 'status' => 400, )

https://www.mywebsite.com/?post=242034&action=edit&meta-box-loader=1&meta-box-loader-nonce=783f7f9410&_locale=user (2023-12-12 09:16:49)

error: request body is required recommended_solution: We did not recognize this error. Please consider opening a GitHub Issue so we can add it to our list of supported errors. es_req: POST http://localhost:9200/%INDEX_NAME%/_bulk request_id: 31e274f6ffa64a97a98b5ce081c6f5a4 query_time: 0.82588195800781 wp_args: array ( ) status_code: 400 body: result: array ( 'error' => array ( 'root_cause' => array ( 0 => array ( 'type' => 'parse_exception', 'reason' => 'request body is required', ), ), 'type' => 'parse_exception', 'reason' => 'request body is required', ), 'status' => 400, )

https://www.mywebsite.com/?post=247156&action=edit&meta-box-loader=1&meta-box-loader-nonce=783f7f9410&_locale=user (2023-12-12 09:16:05)

error: request body is required recommended_solution: We did not recognize this error. Please consider opening a GitHub Issue so we can add it to our list of supported errors. es_req: POST http://localhost:9200/%INDEX_NAME%/_bulk request_id: a09f569ff13e4be59cdb16f4945d9cad query_time: 0.85186958312988 wp_args: array ( ) status_code: 400 body: result: array ( 'error' => array ( 'root_cause' => array ( 0 => array ( 'type' => 'parse_exception', 'reason' => 'request body is required', ), ), 'type' => 'parse_exception', 'reason' => 'request body is required', ), 'status' => 400, )

https://www.mywebsite.com/?post=258265&action=edit&meta-box-loader=1&meta-box-loader-nonce=0286ed8822&_locale=user (2023-12-12 08:43:30)

error: request body is required recommended_solution: We did not recognize this error. Please consider opening a GitHub Issue so we can add it to our list of supported errors. es_req: POST http://localhost:9200/%INDEX_NAME%/_bulk request_id: 967bcf4d2066402fae2fb2a917ec7616 query_time: 0.80704689025879 wp_args: array ( ) status_code: 400 body: result: array ( 'error' => array ( 'root_cause' => array ( 0 => array ( 'type' => 'parse_exception', 'reason' => 'request body is required', ), ), 'type' => 'parse_exception', 'reason' => 'request body is required', ), 'status' => 400, )

WordPress

WordPress Environment

wp_version: 6.4.2 home_url: https://www.mywebsite.com site_url: https://www.mywebsite.com is_multisite: false theme: APC plugins: Advanced Custom Fields PRO (6.2.4), Antispam Bee (2.11.5), Classic Widgets (0.3), ElasticPress (5.0.0), Optimus (1.6.3), Prosodia VGW OS (3.25.3), RafflePress Pro (1.12.2), SEOPress (7.2), SEOPress PRO (7.2), Simple History (4.8.0), Solid Security Basic (9.2.0), Statify (1.8.4), TablePress (2.2.3), W3 Total Cache (2.6.1), WP Mail SMTP (3.10.0) und Yet Another Related Posts Plugin (YARPP) (5.30.9) revisions: all

Server Environment

php_version: 8.2.13 memory_limit: 2056M timeout: 3600

Indexable Content

XX https://www.mywebsite.com

post_count: 13.004 page_count: 29 post_meta_keys: 3 page_meta_keys: 1 total-all-post-types: 3 distinct-meta-keys: _apcPostBrand, apc_post_rating_product_name und ep_exclude_from_search

ElasticPress

Settings

host: http://localhost:9200 index_prefix: language: de_DE per_page: 500 network_active: false

Timeouts

request_timeout: 5 index_document_timeout: 15 bulk_request_timeout: 30

Elasticsearch Indices

%INDEX_NAME%

health: yellow status: open index: %INDEX_NAME% uuid: ErKeTdZtS-uH8s-g05Ri8Q pri: 5 rep: 1 docs.count: 12980 docs.deleted: 172 store.size: 292mb pri.store.size: 292mb total_fields_limit: 5000 analyzer_language: german stop_language: german snowball_language: German

Last Sync

2023/12/01 2:28:14 pm

method: WP Dashboard is_full_sync: No end_date_time: 2023/12/01 2:31:54 pm total_time: 0 Stunden, 3 Minuten, 40 Sekunden total: 12955 synced: 12955 skipped: 0 failed: 0 errors: array ( ) trigger: manual final_status: success

Feature Settings

Autosuggest

active: true autosuggest_selector: endpoint_url: https://www.mywebsite.com/wp-json/apc/v1/search/suggestions/ force_inactive: false trigger_ga_event: 0

Custom Search Results

active: true force_inactive: false

Did You Mean

active: true force_inactive: false search_behavior: 0

Post Search

active: true decaying_enabled: 0 force_inactive: false highlight_enabled: 1 highlight_excerpt: 1 highlight_tag: mark synonyms_editor_mode: simple synonyms:

# Defined sets ( equivalent synonyms).
1&1, einsundeins, 1 und 1
coolermaster, cooler master
samsung galaxy, galaxy

Defined alternatives (explicit mappings).

shoes => sneaker, sandal, boots, high heels

weighting: array ( 'post' => array ( 'post_title' => array ( 'enabled' => true, 'weight' => 65, ), 'post_content' => array ( 'weight' => 1, 'enabled' => false, ), 'post_excerpt' => array ( 'weight' => 1, 'enabled' => false, ), 'author_name' => array ( 'weight' => 1, 'enabled' => false, ), 'terms.post_tag.name' => array ( 'weight' => 9, 'enabled' => false, ), 'terms.category.name' => array ( 'weight' => 13, 'enabled' => false, ), 'terms.ep_custom_result.name' => array ( 'enabled' => true, 'weight' => 9999, 'fuzziness' => false, ), 'meta.apc_post_rating_product_name.value' => array ( 'weight' => 100, 'enabled' => true, ), 'meta._apcPostBrand.value' => array ( 'enabled' => true, 'weight' => 50, ), ), 'page' => array ( 'post_title' => array ( 'weight' => 15, 'enabled' => true, ), 'post_content' => array ( 'weight' => 100, 'enabled' => true, ), 'post_excerpt' => array ( 'enabled' => true, 'weight' => 1, ), 'author_name' => array ( 'enabled' => true, 'weight' => 1, ), 'terms.ep_custom_result.name' => array ( 'enabled' => true, 'weight' => 9999, 'fuzziness' => false, ), ), )

Code of Conduct

felipeelia commented 9 months ago

Thanks for opening the issue @APCgit. It should be fixed by https://github.com/10up/ElasticPress/pull/3770 (released in EP 5.0.1) now.