# NEST vs. javascript/jquery - Trying to get started

**URL:** <https://discuss.elastic.co/t/nest-vs-javascript-jquery-trying-to-get-started/7296>\
**Category:** Elasticsearch\
**Created:** [April 11, 2012, 2:55pm UTC](https://discuss.elastic.co/t/nest-vs-javascript-jquery-trying-to-get-started/7296 "2012-04-11T14:55:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Duarte\_Figuei](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@Daniel\_Duarte\_Figuei](https://discuss.elastic.co/u/Daniel_Duarte_Figuei)\
**Post date:** [April 11, 2012, 2:55pm UTC](https://discuss.elastic.co/t/nest-vs-javascript-jquery-trying-to-get-started/7296/1 "2012-04-11T14:55:22Z")

</div>

Hello everyone,  
This is my first message here and I am new to ElasticSearch.  
I am currently developing an [ASP.NET](http://ASP.NET) MVC application using the Razor View  
Engine.  
I'm using an AWS server with two nodes (ec2 small server), using the NGINX  
proxy. I configured the server using this tutorial:  
[http://www.elasticsearch.org/tutorials/2012/03/21/deploying-elasticsearch-with-chef-solo.html](http://www.elasticsearch.org/tutorials/2012/03/21/deploying-elasticsearch-with-chef-solo.html)

_My question is_: what is the best way to implement the client-server  
communication? I was trying to add a script in my view to put or get  
indexes in/from the server,  
but I couldn't make it work. Then I read about NEST and it seems pretty  
interesting, so what do you think is the best way to start?  
Are there any advantages or disadvantages in the use of NEST? How can I  
configure the connection using the NGINX proxy (the problems I went through  
seem to be  
related with the proxy)?

* * *

_Just to ilustrate how I was trying to make the connection:_  
_I wrote a simple script in my .cshtml file that was supposed to retrieve a  
previously created index:_

var username="USERNAME";  
var password="PASSWORD"

function getElastic() {  
jQuery.support.cors = true;  
$.ajax({  
crossDomain:true,  
xhrFields: {  
withCredentials: true  
},  
beforeSend: function (req, settings) {  
req.setRequestHeader('Authorization',  
make\_base\_auth(username, password));  
},  
url:  
'[http://USERNAME](http://USERNAME):PASSWORD@SERVER\_IP/test\_chef\_cookbook/document/\_search?pretty=true',  
type: 'POST',  
data: JSON.stringify({  
"query": { "match\_all": {} }  
}),  
dataType: 'json',  
processData: false,  
success: function (json, statusText, xhr) {  
alert(json);  
return;  
},  
error: function (xhr, message, error) {  
alert(error);  
}  
});  
}

---

<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:32am UTC](https://discuss.elastic.co/t/nest-vs-javascript-jquery-trying-to-get-started/7296/2 "2017-07-06T03:32:54Z")

</div>


