# JS API not working

**URL:** <https://discuss.elastic.co/t/js-api-not-working/24737>\
**Category:** Elasticsearch\
**Created:** [July 1, 2015, 2:55pm UTC](https://discuss.elastic.co/t/js-api-not-working/24737 "2015-07-01T14:55:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbbush](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jbbush](https://discuss.elastic.co/u/jbbush)\
**Post date:** [July 1, 2015, 2:55pm UTC](https://discuss.elastic.co/t/js-api-not-working/24737/1 "2015-07-01T14:55:00Z")

</div>

(I'm very new to JS so you may need to spoon feed me some details 🙂 )

I'm trying to write js to query my ES indexes. I've read a ton of material and seen lots of examples but I can't make it work. I'm looking for some working examples and instructions on how to install the required parts to make this work. I already have ES indexes to use so I just need help with my js client.

The following is straight from some examples that I've seen. I keep getting errors like the following but I'm not really sure what to do with this since I can't find any examples using require([])  
SCRIPT5022: Module name "scripts/elasticsearch" has not been loaded yet for context: \_. Use require([]) [http://requirejs.org/docs/errors.html#notloaded](http://requirejs.org/docs/errors.html#notloaded)

I have a dir structure like  
../ESIntegration  
ESIntegration.js  
/scripts  
elasticsearch.js  
require.js

---

<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:04am UTC](https://discuss.elastic.co/t/js-api-not-working/24737/2 "2017-07-06T00:04:12Z")

</div>


