# getting org.elasticsearch.action.ActionRequestValidationException?

**URL:** https://discuss.elastic.co/t/getting-org-elasticsearch-action-actionrequestvalidationexception/6018
**Category:** Elasticsearch
**Created:** [November 30, 2011, 5:08am UTC](https://discuss.elastic.co/t/getting-org-elasticsearch-action-actionrequestvalidationexception/6018 "2011-11-30T05:08:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Sam\_4](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sam\_4](https://discuss.elastic.co/u/Sam_4)
#### Post date: [November 30, 2011, 5:08am UTC](https://discuss.elastic.co/t/getting-org-elasticsearch-action-actionrequestvalidationexception/6018/1 "2011-11-30T05:08:41Z")

</div>

Hi

I am using elastic server 0.16.2.i have used following code for  
RabbitMQRiver:

public class RabbitMQRiverTest {

```
public static void main(String[] args) throws Exception {

    Node node =

```

NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder().put("gateway.type",  
"none")).node();

```
    node.client().prepareIndex("_river", "test1",

```

"\_meta").setSource(jsonBuilder().startObject().field("type",  
"rabbitmq").endObject()).execute().actionGet();

```
    ConnectionFactory cfconn = new ConnectionFactory();
    cfconn.setHost("localhost");
    cfconn.setPort(AMQP.PROTOCOL.PORT);
    Connection conn = cfconn.newConnection();

    Channel ch = conn.createChannel();
    ch.exchangeDeclare("elasticsearch", "direct", true);
    ch.queueDeclare("elasticsearch", true, false, false, null);

    String message = "{ \"index\" : { \"index\" : \"test\", \"type

```

" : "type1", "id" : "1"} }\n" +  
"{ "type1" : { "field1" : "value1" } }\n" +  
"{ "delete" : { "index" : "test", "type" :  
"type1", "id" : "2" } }\n" +  
"{ "create" : { "index" : "test", "type" :  
"type1", "id" : "1" }}\n" +  
"{ "type1" : { "field1" : "value1" } }";  
System.out.println(message);  
ch.basicPublish("elasticsearch", "elasticsearch", null,  
message.getBytes());  
System.out.println("publish sucessfully");  
ch.close();  
conn.close();

```
}

```

}

I got the following exception:

org.elasticsearch.action.ActionRequestValidationException: Validation  
Failed: 1: index is missing2: type is missing3: index is missing4:  
type is missing5: id is missing6: index is missing7: type is missing8:  
index is missing9: type is missing10: index is missing11: type is  
missing12: id is missing  
at  
org.elasticsearch.action.bulk.BulkRequest.validate(BulkRequest.java:  
239)  
at  
org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:  
55)  
at org.elasticsearch.client.node.NodeClient.bulk(NodeClient.java:136)  
at  
org.elasticsearch.client.action.bulk.BulkRequestBuilder.doExecute(BulkRequestBuilder.java:  
122)  
at  
org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:  
56)  
at org.elasticsearch.river.rabbitmq.RabbitmqRiver  
$Consumer.run(RabbitmqRiver.java:277)  
at java.lang.Thread.run(Thread.java:619)

please tell me where is the problem and solution for this exception.

Thanks

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [November 30, 2011, 6:19am UTC](https://discuss.elastic.co/t/getting-org-elasticsearch-action-actionrequestvalidationexception/6018/2 "2011-11-30T06:19:48Z")

</div>

Format of your String message is incorrect.  
Don't forget the underscores \_ for \_type, \_id, \_index

See here : [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/river/rabbitmq.html)

HTH  
David 😉  
@dadoonet

Le 30 nov. 2011 à 06:08, sam [mishra.sameek@gmail.com](mailto:mishra.sameek@gmail.com) a écrit :

> Hi
> 
> I am using elastic server 0.16.2.i have used following code for  
> RabbitMQRiver:
> 
> public class RabbitMQRiverTest {
> 
> public static void main(String args) throws Exception {
> 
> ```
> Node node =
> 
> ```
> 
> NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder().put("gateway.type",  
> "none")).node();
> 
> ```
> node.client().prepareIndex("_river", "test1",
> 
> ```
> 
> "\_meta").setSource(jsonBuilder().startObject().field("type",  
> "rabbitmq").endObject()).execute().actionGet();
> 
> ```
> ConnectionFactory cfconn = new ConnectionFactory();
> cfconn.setHost("localhost");
> cfconn.setPort(AMQP.PROTOCOL.PORT);
> Connection conn = cfconn.newConnection();
> 
> Channel ch = conn.createChannel();
> ch.exchangeDeclare("elasticsearch", "direct", true);
> ch.queueDeclare("elasticsearch", true, false, false, null);
> 
> String message = "{ \"index\" : { \"index\" : \"test\", \"type
> 
> ```
> 
> " : "type1", "id" : "1"} }\n" +  
> "{ "type1" : { "field1" : "value1" } }\n" +  
> "{ "delete" : { "index" : "test", "type" :  
> "type1", "id" : "2" } }\n" +  
> "{ "create" : { "index" : "test", "type" :  
> "type1", "id" : "1" }}\n" +  
> "{ "type1" : { "field1" : "value1" } }";  
> System.out.println(message);  
> ch.basicPublish("elasticsearch", "elasticsearch", null,  
> message.getBytes());  
> System.out.println("publish sucessfully");  
> ch.close();  
> conn.close();
> 
> }  
> }
> 
> I got the following exception:
> 
> org.elasticsearch.action.ActionRequestValidationException: Validation  
> Failed: 1: index is missing2: type is missing3: index is missing4:  
> type is missing5: id is missing6: index is missing7: type is missing8:  
> index is missing9: type is missing10: index is missing11: type is  
> missing12: id is missing  
> at  
> org.elasticsearch.action.bulk.BulkRequest.validate(BulkRequest.java:  
> 239)  
> at  
> org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:  
> 55)  
> at org.elasticsearch.client.node.NodeClient.bulk(NodeClient.java:136)  
> at  
> org.elasticsearch.client.action.bulk.BulkRequestBuilder.doExecute(BulkRequestBuilder.java:  
> 122)  
> at  
> org.elasticsearch.client.action.support.BaseRequestBuilder.execute(BaseRequestBuilder.java:  
> 56)  
> at org.elasticsearch.river.rabbitmq.RabbitmqRiver  
> $Consumer.run(RabbitmqRiver.java:277)  
> at java.lang.Thread.run(Thread.java:619)
> 
> please tell me where is the problem and solution for this exception.
> 
> Thanks

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 3:46am UTC](https://discuss.elastic.co/t/getting-org-elasticsearch-action-actionrequestvalidationexception/6018/3 "2017-07-06T03:46:59Z")

</div>


