# Sending JSON from Java/Scala

**URL:** <https://discuss.elastic.co/t/sending-json-from-java-scala/6610>\
**Category:** Elasticsearch\
**Created:** [February 6, 2012, 11:07pm UTC](https://discuss.elastic.co/t/sending-json-from-java-scala/6610 "2012-02-06T23:07:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sun](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@sun](https://discuss.elastic.co/u/sun)\
**Post date:** [February 6, 2012, 11:07pm UTC](https://discuss.elastic.co/t/sending-json-from-java-scala/6610/1 "2012-02-06T23:07:06Z")

</div>

I tried to use JSON and send it via the Java API: git://gist.github.com/1755734.git

Is this posible?

The JSON doc in this case is ignored and I get all results, the result  
is the same when I leave out setSource completely.

---

<div class="post-metadata">

**Author:** ![Eric\_Jain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_jain/32/834_2.png) [@Eric\_Jain](https://discuss.elastic.co/u/Eric_Jain)\
**Post date:** [February 7, 2012, 4:30am UTC](https://discuss.elastic.co/t/sending-json-from-java-scala/6610/2 "2012-02-07T04:30:00Z")

</div>

On Feb 6, 3:07 pm, sun [goo...@suncom.de](mailto:goo...@suncom.de) wrote:

> I tried to use JSON and send it via the Java API: git://gist.github.com/1755734.git
> 
> Is this posible?
> 
> The JSON doc in this case is ignored and I get all results, the result  
> is the same when I leave out setSource completely.

You need to un-nest the source one level:

[https://gist.github.com/1757170](https://gist.github.com/1757170)

---

<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:40am UTC](https://discuss.elastic.co/t/sending-json-from-java-scala/6610/3 "2017-07-06T03:40:25Z")

</div>


