0

I have Installed elasticsearch-6.3.1 in windows & try to filter the data by using following code in angular 1,it gives CORS error

$http({
            url: 'http://localhost:9200/empinfo/employeedetails/_search',
            method: "POST",
            data: "{ 'query': { 'query_string': { 'query': 'Sujit','fields':['name'] } } }",
            headers: { 'Content-Type': 'application/json' }
        }).success(function (data, status, headers, config) {
            console.log(data);
        }).error(function (data, status, headers, config) {
        });

My Elastic search error in angular.js

1

Although I have added Allow CORS in elasticsearch.yml file.

Please help me.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
sujit
  • 1
  • 1
  • The $http `.success` method has been [deprecated and removed from V1.6](https://stackoverflow.com/questions/35329384/why-are-angularjs-http-success-error-methods-deprecated-removed-from-v1-6/35331339#35331339). – georgeawg Jul 11 '18 at 15:17

1 Answers1

1

You need to uncomment the lines in your yml file. Simply remove '#' from the beginning of each line. Restart your Elasticsearch.