10up / ElasticPress

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

BUG: "request body is required" Failed Queries #3755

Closed yellowbigbanana closed 12 months ago

yellowbigbanana commented 1 year ago

Describe the bug

From the error log:-

We're getting an error entered below. 06850286 I'm not a coder (sorry!) but I am worried that this is a major problem. I've hidden the real domain - it made me nervous putting it on a site that has crack coders on it. But then again they could probably just work it out.

Steps to Reproduce

This show up as an error on our Elasticpress status report.

Error request body is required

Screenshots, screen recording, code snippet

No response

Environment information

Our hosting service - pagely.com is our environment

PHP Version | 8.0.30 Memory Limit | 512M Maximum Execution Time | 60

WordPress and ElasticPress information

Failed Queries

https://www.hiddendomain.com.au (2023-11-09 10:25:21)

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://nbntv.vps.pagelyhosting-private.com:9200/hiddendomain-post-1/_bulk request_id: 18a574b443e24dd0a19e4d3717d18f2d query_time: 1.3928413391113 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.hiddendomain.com.au (2023-11-09 10:23:48)

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://nbntv.vps.pagelyhosting-private.com:9200/hiddendomain-post-1/_bulk request_id: 47d02038479746c08c1201eff4a87533 query_time: 1.3139247894287 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.hiddendomain.com.au (2023-11-09 10:17:37)

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://nbntv.vps.pagelyhosting-private.com:9200/hiddendomain-post-1/_bulk request_id: 089bd16ae0af4e748bb5c5752e94f66d query_time: 1.3167858123779 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.hiddendomain.com.au (2023-11-09 10:16:00)

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://nbntv.vps.pagelyhosting-private.com:9200/hiddendomain-post-1/_bulk request_id: 2fa782bef4a048ea9ab8db176274f46c query_time: 1.9080638885498 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.hiddendomain.com.au (2023-11-09 10:12:37)

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://nbntv.vps.pagelyhosting-private.com:9200/hiddendomain-post-1/_bulk request_id: 18b62d8911d14471a950414a69010c20 query_time: 37.131071090698 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.3.2 home_url: https://www.hiddendomain.com.au site_url: https://www.hiddendomain.com.au is_multisite: false theme: Jannah Child (1.0.2) parent_theme: Jannah (7.0.3) plugins: Activity Log (2.8.8), Advanced Custom Fields (6.2.2), Akismet Anti-spam: Spam Protection (5.3), Classic Editor (1.6.3), Classic Widgets (0.3), Default featured image (1.7.3), ElasticPress (5.0.0), ElasticPress Debugging Add-On (3.1.0), Envato Market (2.0.10), FooBox Image Lightbox (Premium) (2.7.23), FooGallery (2.3.3), Jannah - Extensions (1.1.2), Jannah Autoload Posts (1.3.0), Jannah Speed Optimization (1.2.6), Jannah Switcher (1.0.4), Limit Login Attempts Reloaded (2.25.26), Post-Plugin Library (2.6.2.1), Regenerate Thumbnails (3.1.6), Simple Local Avatars (2.7.5), Smush Pro (3.15.0), Social Counters - Arqam Lite (1.0.12), Stop Spammers (2023.4.1), Taqyeem (2.7.0), TieLabs Instagram Feed (1.1.3), WP-PageNavi (2.94.1), WP-Polls (2.77.2), WP-ServerInfo (1.66), WP Bulk Delete (1.2.6), WP Maintenance (6.1.3), WPMU DEV Dashboard (4.11.22), WPMU DEV Videos (1.8.13), and Yoast Duplicate Post (4.5) revisions: 0

Server Environment

php_version: 8.0.30 memory_limit: 512M timeout: 60

Indexable Content

NBN News — https://www.hiddendomain.com.au

post_count: 150,325 page_count: 144 attachment_count: 76,975 acf-taxonomy_count: 0 acf-post-type_count: 0 acf-field-group_count: 1 acf-field_count: 2 tie_slider_count: 8 wpmudev_custom_video_count: 54 post_meta_keys: 1 page_meta_keys: 1 attachment_meta_keys: 0 acf-taxonomy_meta_keys: 0 acf-post-type_meta_keys: 0 acf-field-group_meta_keys: 0 acf-field_meta_keys: 0 tie_slider_meta_keys: 0 wpmudev_custom_video_meta_keys: 0 total-all-post-types: 1 distinct-meta-keys: ep_exclude_from_search

ElasticPress

Settings

host: http://nbntv.vps.pagelyhosting-private.com:9200 index_prefix: language: en_AU per_page: 350 network_active: false

Timeouts

request_timeout: 5 index_document_timeout: 15 bulk_request_timeout: 30

Elasticsearch Indices

hiddendomain-post-1

health: green status: open index: hiddendomain-post-1 uuid: SfdQm6DTQp2ZYTMU6zu8uA pri: 5 rep: 0 docs.count: 227516 docs.deleted: 54234 store.size: 949.7mb pri.store.size: 949.7mb total_fields_limit: 5000 analyzer_language: english stop_language: english snowball_language: English

Last Sync

2023/10/05 1:02:44 pm

method: WP-CLI is_full_sync: Yes end_date_time: 2023/10/05 1:22:54 pm total_time: 0 hours, 20 minutes, 10 seconds total: 226478 synced: 226479 skipped: 0 failed: 0 errors: array ( )

Feature Settings

Custom Search Results

active: true force_inactive: false

Filters

active: true force_inactive: false match_type: all

Post Search

active: true decaying_enabled: 1 force_inactive: false synonyms:

# Defined sets (equivalent synonyms).
sneakers, tennis shoes, trainers, runners

Defined alternatives (explicit mappings).

shoes => sneaker, sandal, boots, high heels

weighting: array ( )

Protected Content

active: true force_inactive: false

Related Posts

active: true force_inactive: false

Code of Conduct

archon810 commented 1 year ago

Getting a similar issue, except we're not on 5.0 yet and have been seeing it sporadically for a long time.

Error   
Validation Failed: 1: no requests added;
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.
Elasticsearch Request   
POST http://XXXXXX:9200/XXXXXXXXXXXXXXXXXX/_bulk
Time Spent (ms) 10.037899017333984
WP Query Args   
[]
HTTP Status Code    400
Query Body  
Query Result    
{
  "error": {
    "root_cause": [
      {
        "type": "action_request_validation_exception",
        "reason": "Validation Failed: 1: no requests added;"
      }
    ],
    "type": "action_request_validation_exception",
    "reason": "Validation Failed: 1: no requests added;"
  },
  "status": 400
}

What I think is happening for us is a post is created in WP, then quickly deleted due to some validation, but EP doesnt realize this and tries to index a blank request. Can this not just silently fail instead of notifying?