# ElasticsearchException: Validation Failed: 1: index is not specified;2: source is not specified;

- **ID:** `elasticsearch/action-request-validation-error`
- **Domain:** elasticsearch
- **Category:** protocol_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

An API request is missing required parameters such as index name or source body, causing validation to fail.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| elasticsearch 7.0.0 | active | — | — |
| elasticsearch 8.0.0 | active | — | — |
| elasticsearch 8.12.0 | active | — | — |

## Workarounds

1. **Ensure the request includes both 'index' and 'body' parameters. For example, in Python: es.index(index="my_index", body={"field": "value"})** (95% success)
   ```
   Ensure the request includes both 'index' and 'body' parameters. For example, in Python: es.index(index="my_index", body={"field": "value"})
   ```
2. **Use the REST API with proper path and body: POST /my_index/_doc { "field": "value" }** (98% success)
   ```
   Use the REST API with proper path and body: POST /my_index/_doc { "field": "value" }
   ```
3. **If using bulk API, verify each action line includes '_index' and '_source' fields.** (90% success)
   ```
   If using bulk API, verify each action line includes '_index' and '_source' fields.
   ```

## Dead Ends

- **** — An empty body may still pass validation but can cause indexing errors if required fields are missing. (30% fail)
- **** — Retrying without fixing the missing parameters will always fail with the same validation error. (100% fail)
- **** — HTTP method does not change required parameters; validation is based on the API endpoint and body. (90% fail)
