【问题标题】:elastic search for AngularJS -- Cross-Origin Request BlockedAngularJS的弹性搜索——跨域请求被阻止
【发布时间】:2018-12-19 16:08:06
【问题描述】:

我已经在 windows 中安装了 elasticsearch-6.3.1 并尝试使用 angular 1 中的以下代码过滤数据,它给出了 CORS 错误

$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) {
        });

我在 angular.js 中的 Elastic 搜索错误

虽然我在 elasticsearch.yml 文件中添加了 Allow CORS。

请帮帮我。

【问题讨论】:

标签: angularjs elasticsearch cors


【解决方案1】:

您需要取消注释 yml 文件中的行。 只需从每行的开头删除“#”。重新启动您的 Elasticsearch。

【讨论】:

    猜你喜欢
    • 2017-12-14
    • 1970-01-01
    • 2014-11-10
    • 2021-06-26
    • 2014-10-13
    • 2017-01-09
    • 1970-01-01
    相关资源
    最近更新 更多