elastic search for AngularJS — Cross-Origin Request Blocked
elastic search for AngularJS — Cross-Origin Request Blocked
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

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

Please help me.
.success
1 Answer
1
You need to uncomment the lines in your yml file.
Simply remove '#' from the beginning of each line. Restart your Elasticsearch.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
The $http
.successmethod has been deprecated and removed from V1.6.– georgeawg
Jul 11 at 15:17