# Elasticsearch for json array

**URL:** <https://discuss.elastic.co/t/elasticsearch-for-json-array/10654>\
**Category:** Elasticsearch\
**Created:** [February 7, 2013, 8:03pm UTC](https://discuss.elastic.co/t/elasticsearch-for-json-array/10654 "2013-02-07T20:03:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nsharma](https://avatars.discourse-cdn.com/v4/letter/n/a4c791/32.png) [@nsharma](https://discuss.elastic.co/u/nsharma)\
**Post date:** [February 7, 2013, 8:03pm UTC](https://discuss.elastic.co/t/elasticsearch-for-json-array/10654/1 "2013-02-07T20:03:52Z")

</div>

So I have an array as such.

[root]# cat testcase.json  
[  
{  
"a": [  
"1"  
],  
"b": [  
"2"  
]  
},  
{  
"a": [  
"3"  
],  
"b": [  
"4"  
]  
},  
{  
"a": [  
"5"  
],  
"b": [  
"6"  
]  
}  
]

[root]# curl -XPUT '[http://localhost:9200/test/test/1](http://localhost:9200/test/test/1)' -d @testcase.json  
{"error":"MapperParsingException[Malformed content, must start with an  
object]","status":400}

How do i get this working with indexing on elastic search?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [February 8, 2013, 10:00am UTC](https://discuss.elastic.co/t/elasticsearch-for-json-array/10654/2 "2013-02-08T10:00:52Z")

</div>

On Thu, 2013-02-07 at 12:03 -0800, nsharma wrote:

> So I have an array as such.
> 
> [root]# cat testcase.json  
> [  
> {  
> "a": [  
> "1"  
> ],  
> "b": [  
> "2"  
> ]  
> },  
> {  
> "a": [  
> "3"  
> ],  
> "b": [  
> "4"  
> ]  
> },  
> {  
> "a": [  
> "5"  
> ],  
> "b": [  
> "6"  
> ]  
> }  
> ]
> 
> [root]# curl -XPUT '[http://localhost:9200/test/test/1](http://localhost:9200/test/test/1)' -d  
> @testcase.json  
> {"error":"MapperParsingException[Malformed content, must start with an  
> object]","status":400}
> 
> How do i get this working with indexing on Elasticsearch?

Wrap it in an object, eg:

{ data: [{ a: [1],....}]}

clint

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:52am UTC](https://discuss.elastic.co/t/elasticsearch-for-json-array/10654/3 "2017-07-06T02:52:29Z")

</div>


