elasticsearch ajax调用错误

I try to use elasticsearch with an ajax call in my jquery webpage but I fail to make it work...

here is my ajax query :

var data = {
                query:{match:{_all:10}},
                fields: 'DEPET'
                };
            $.ajax({
                type : 'POST', // envoi des données en GET ou POST
                url : 'http://localhost:9200/_search' , // url du fichier de traitement
                crossDomain: true,  
              async: false,
              data: JSON.stringify(data),
              dataType : 'json',
                beforeSend : function() { // traitements JS à faire AVANT l'envoi
                    $('#ajax-loader2').append('<img src="/dev/wp-content/themes/codium-dn/images/ripple.gif" alt="loader" id="ajax-loader" />');
                },
                success : function(data){ // traitements JS à faire APRES le retour d'ajax-search.php
                    $('#ajax-loader').remove(); // on enleve le loader
                    $('#results').html(data); // affichage des résultats dans le bloc
                    console.log(data);
                },
                error: function (data, error) {
                    console.log(arguments);
                    //alert(" Can't do because: " + error);
                }
            })

I also put this in my elasticsearch.yml

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-credentials: true
http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length, Authorization"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE

And this is what the console chrome dev give me :

(index):451 (3) [Object, "error", DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:9200/_s…, callee: function, Symbol(Symbol.iterator): function]

Request URL:http://localhost:9200/_search
Referrer Policy:no-referrer-when-downgrade
Request Headers
Provisional headers are shown
Accept:application/json, text/javascript, */*; q=0.01
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Origin:https://domain.ovh
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.33 Safari/537.36
Form Data
view source
view URL encoded
{"query":{"match":{"_all":10}},"fields":"DEPET"}:

Thanks for your inputs

Try out this

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://localhost:9200/_search",
  "method": "POST",
  "headers": {
    "cache-control": "no-cache",
    "postman-token": "c24112d5-9dc4-0230-7954-01064b61be5c"
  },
  "data": "{
  \"query\": {
    \"match_all\": {}
  }
}
"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

I have used postman tool to generate this code.