# ActionRequestValidationException when attempting to set mapping

**URL:** <https://discuss.elastic.co/t/actionrequestvalidationexception-when-attempting-to-set-mapping/22859>\
**Category:** Elasticsearch\
**Created:** [March 24, 2015, 3:06pm UTC](https://discuss.elastic.co/t/actionrequestvalidationexception-when-attempting-to-set-mapping/22859 "2015-03-24T15:06:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blake1024](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@blake1024](https://discuss.elastic.co/u/blake1024)\
**Post date:** [March 24, 2015, 3:06pm UTC](https://discuss.elastic.co/t/actionrequestvalidationexception-when-attempting-to-set-mapping/22859/1 "2015-03-24T15:06:09Z")

</div>

I am attempting to define a mapping. I am first creating a new index by  
adding a document that doesn't contain anything specified in my  
mapping/schema. I am using a bulk operation to set the mapping but I get  
an ActionRequestValidationException error each time. Here is my JS code:

var mappings = {  
"body": [  
{ "mappings": {  
"component": {  
"properties": {  
"classifications": {  
"type": "string",  
"index": "not\_analyzed"  
}  
}  
}  
}}  
]  
};  
client.bulk(mappings, function(err, resp){  
// error appears here  
});

The exact message I get is: ActionRequestValidationException[Validation Failed: 1: no requests added;]

Any help would sure be appreciated.

Blake McBride

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/7e4580c1-708e-4cf8-a39e-a8bcc314d65b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7e4580c1-708e-4cf8-a39e-a8bcc314d65b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Boaz\_Leskes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/boaz_leskes/32/723_2.png) [@Boaz\_Leskes](https://discuss.elastic.co/u/Boaz_Leskes)\
**Post date:** [March 25, 2015, 7:51am UTC](https://discuss.elastic.co/t/actionrequestvalidationexception-when-attempting-to-set-mapping/22859/2 "2015-03-25T07:51:47Z")

</div>

Hi Blake,

I'm not an expert in the JS client, but the bulk requests are meant for  
indexing data. If you want to set the mapping you can do it in index  
creation time or by using the dedicate put mapping API  
( [Update mapping API | Elasticsearch Guide [8.11] | Elastic](http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html)  
).

Cheers,  
Boaz

On Tuesday, March 24, 2015 at 4:06:09 PM UTC+1, Blake McBride wrote:

> I am attempting to define a mapping. I am first creating a new index by  
> adding a document that doesn't contain anything specified in my  
> mapping/schema. I am using a bulk operation to set the mapping but I get  
> an ActionRequestValidationException error each time. Here is my JS code:
> 
> var mappings = {  
> "body": [  
> { "mappings": {  
> "component": {  
> "properties": {  
> "classifications": {  
> "type": "string",  
> "index": "not\_analyzed"  
> }  
> }  
> }  
> }}  
> ]  
> };  
> client.bulk(mappings, function(err, resp){  
> // error appears here  
> });
> 
> The exact message I get is: ActionRequestValidationException[Validation Failed: 1: no requests added;]
> 
> Any help would sure be appreciated.
> 
> Blake McBride

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/dcc42ef8-7a5e-47ac-8953-2a873cb172da%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/dcc42ef8-7a5e-47ac-8953-2a873cb172da%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![blake1024](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@blake1024](https://discuss.elastic.co/u/blake1024)\
**Post date:** [March 25, 2015, 2:50pm UTC](https://discuss.elastic.co/t/actionrequestvalidationexception-when-attempting-to-set-mapping/22859/3 "2015-03-25T14:50:31Z")

</div>

Yea. Thanks. As you suggested, I bypassed the JS API and just did an HTTP  
call. That worked. Thanks.

On Wednesday, March 25, 2015 at 2:51:47 AM UTC-5, Boaz Leskes wrote:

> Hi Blake,
> 
> I'm not an expert in the JS client, but the bulk requests are meant for  
> indexing data. If you want to set the mapping you can do it in index  
> creation time or by using the dedicate put mapping API (  
> [Update mapping API | Elasticsearch Guide [8.11] | Elastic](http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html)  
> ).
> 
> Cheers,  
> Boaz
> 
> On Tuesday, March 24, 2015 at 4:06:09 PM UTC+1, Blake McBride wrote:
> 
> > I am attempting to define a mapping. I am first creating a new index by  
> > adding a document that doesn't contain anything specified in my  
> > mapping/schema. I am using a bulk operation to set the mapping but I get  
> > an ActionRequestValidationException error each time. Here is my JS code:
> > 
> > var mappings = {  
> > "body": [  
> > { "mappings": {  
> > "component": {  
> > "properties": {  
> > "classifications": {  
> > "type": "string",  
> > "index": "not\_analyzed"  
> > }  
> > }  
> > }  
> > }}  
> > ]  
> > };  
> > client.bulk(mappings, function(err, resp){  
> > // error appears here  
> > });
> > 
> > The exact message I get is: ActionRequestValidationException[Validation Failed: 1: no requests added;]
> > 
> > Any help would sure be appreciated.
> > 
> > Blake McBride

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9b829078-fd15-4c3a-b356-bcacd429a7bb%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9b829078-fd15-4c3a-b356-bcacd429a7bb%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:24am UTC](https://discuss.elastic.co/t/actionrequestvalidationexception-when-attempting-to-set-mapping/22859/4 "2017-07-06T00:24:03Z")

</div>


