# Query to a JSON file

**URL:** <https://discuss.elastic.co/t/query-to-a-json-file/11438>\
**Category:** Elasticsearch\
**Created:** [April 3, 2013, 10:48pm UTC](https://discuss.elastic.co/t/query-to-a-json-file/11438 "2013-04-03T22:48:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![OffensivelyBad\_2](https://avatars.discourse-cdn.com/v4/letter/o/51bf81/32.png) [@OffensivelyBad\_2](https://discuss.elastic.co/u/OffensivelyBad_2)\
**Post date:** [April 3, 2013, 10:48pm UTC](https://discuss.elastic.co/t/query-to-a-json-file/11438/1 "2013-04-03T22:48:29Z")

</div>

I'm attempting to write ajax code in a PHP file that queries elasticsearch  
server and returns a JSON document:

var load\_data = function() {  
$.ajax({ url: '[http://localhost:9200/inventory/\_search?pretty=true](http://localhost:9200/inventory/_search?pretty=true)'  
, type: 'POST'  
, data :  
???????????????????  
"query":{"match\_all":{}}  
})

I'm not sure what I need to type before my query to return a JSON document.  
Could someone lend a hand? 🙂

--  
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:42am UTC](https://discuss.elastic.co/t/query-to-a-json-file/11438/2 "2017-07-06T02:42:55Z")

</div>


