Issue with JS API

I'm trying to write a js client to query my ES indexes. I'm looking for some working examples and instructions on how to install the required parts to make this work. What I've tried so far is not working. I already have ES indexes to use so I just need help with my js client.

The following code 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([]). I'm rather new to JS so my problems could be rather simple.

SCRIPT5022: Module name "scripts/elasticsearch" has not been loaded yet for context: _. Use require([])

I have a dir structure like


It looks like the HTML that I included is not displaying. Here it is again but slightly modified (no leading < braket) so you can see it.

!DOCTYPE html>
html lang="en">

script data-main="scripts/main" src="scripts/require.js">

script type = "text/javascript">
var elasticsearch = require("scripts/elasticsearch.js"); //this is the line having issues
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'

body >