Javascript with ElasticSearch - trying to make POST wortk

For the code below, if the type is set to POST in the code then the
ElasticSearch server returns an error 500. If type is set to GET,
then the query works. Any idea why?

The URL in the code is not publicly accessible and is behind a
firewall.

var myURL = 'http://ec2-54-248-13-166.ap- northeast-1.compute.amazonaws.com:9200/people/person/_search';
        var query = {
            q: 'fullname:smith',
            pretty:'true',
            size:100
        };

        $.ajax({
                url: myURL,
                type: "Post",
                dataType: 'json',
                data: query,
                success: function( data ) { alert(data);}
              });
    </script>
</body>

Just wondering if you should not write POST instead of Post ?

Envoyé de mon iPad

Le 11 mai 2012 à 07:00, Duke Dougal dukedougal@gmail.com a écrit :

For the code below, if the type is set to POST in the code then the
ElasticSearch server returns an error 500. If type is set to GET,
then the query works. Any idea why?

The URL in the code is not publicly accessible and is behind a
firewall.

var myURL = 'http://ec2-54-248-13-166.ap- northeast-1.compute.amazonaws.com:9200/people/person/_search';
       var query = {
           q: 'fullname:smith',
           pretty:'true',
           size:100
       };

       $.ajax({
               url: myURL,
               type: "Post",
               dataType: 'json',
               data: query,
               success: function( data ) { alert(data);}
             });
   </script>

Make sure you are not running into XSS (
http://en.wikipedia.org/wiki/Cross-site_scripting).

On Fri, May 11, 2012 at 7:36 AM, David Pilato david@pilato.fr wrote:

Just wondering if you should not write POST instead of Post ?

Envoyé de mon iPad

Le 11 mai 2012 à 07:00, Duke Dougal dukedougal@gmail.com a écrit :

For the code below, if the type is set to POST in the code then the
ElasticSearch server returns an error 500. If type is set to GET,
then the query works. Any idea why?

The URL in the code is not publicly accessible and is behind a
firewall.

var myURL = 'http://ec2-54-248-13-166.ap- northeast-1.compute.amazonaws.com:9200/people/person/_search';
       var query = {
           q: 'fullname:smith',
           pretty:'true',
           size:100
       };

       $.ajax({
               url: myURL,
               type: "Post",
               dataType: 'json',
               data: query,
               success: function( data ) { alert(data);}
             });
   </script>

Can you try this:

var query = {
q: 'fullname:smith',
pretty:'true',
size:100
};

        $.ajax({ 
                url: myURL, 
                type: "Post", 
               <b> crossDomain: true,
	    dataType: 'json',
	    data: JSON.stringify(query),</b>
                success: function( data ) { alert(data);} 
              });