title: How to send JSON format filter query in ajax request to elasticsearch
body: <p>I am new in elasticsearch and i am looking to explore filters in elsticsearch. I am sending following request to elasticsearch:</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
      $(function () {
          $("#btnSearch").on("click", function () {
              if ($("#txtSearchAllFields").val() != '') {
                  var filter = {
                      "query": {
                          "bool": {
                              "must": [
                                  {
                                      "query_string": {
                                          "default_field": "_all",
                                          "query": $ ("#txtSearchAllFields").val()
                                      }
                                  }
                              ],
                              "must_not": [],
                              "should": []
                          }
                      },
                      "from": 0,
                      "size": 250,
                      "sort": [],
                      "aggs": {}
                  };
  
                  GetEmployee(filter);
              }
          })
  
      });
      function GetEmployee(filter) {
          $.ajax({
              url: "http://easticsearchserver:9200/empmaster/_search",
              crossDomain: true,
              async: false,
              type: 'GET',
              dataType: 'json',
              data: JSON.stringify(filter),
              contentType: 'application/json',
              success: OnSuccess,
              error: function (data) {
                  console.log(data);
              }
          });
      }
  
      function OnSuccess(data) {
          console.log(data);
          $(data.hits.hits).each(function (index, hit) {
  
          });
      };
  &lt;/script&gt;
  </code></pre>
  
  <p>But i am getting Bad request error.</p>
  
  <p>Please let me know how i can send this json query with this request.
  Thanks in advance.</p>