- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
为了部署使用Elasticsearch的firebase应用程序,我正在使用Heroku Bonsai附加组件。
一切都准备就绪,问题是我在传递Ajax请求时遇到了未经授权的错误。完全相同的代码在本地(link)上运行正常,但在部署上却没有。
Ajax.jx
$(function() {
$('#message').keyup(function() {
var query = {
"query": {
"match": {
"song": {
"query": $("#message").val(),
"operator": "and"
}
}
}
};
$.ajax({
type: "POST",
url: "https://<username>:<password>@xxxwood-5671445.xx-xxxx-1.bonsaisearch.net/firebase/_search",
contentType: 'application/json',
crossDomain: true,
data: JSON.stringify(query),
success: searchSuccess,
dataType: 'json'
});
});
});
[~]$ curl -XGET 'https://<username>:<password>@dogwood-5671445.xx-xxxx-1.bonsaisearch.net/firebase/_search?pretty' -H 'Content-Type: application/json' -d'
{"query": {"match": {"song": {"query": "i am in", "operator": "and"}}}}'
cURL result:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.4048493,
"hits" : [ {
"_index" : "firebase",
"_type" : "song",
"_id" : "0001",
"_score" : 1.4048493,
"_source" : {
"song" : "i am in california",
"song_name" : "hello",
"song_url" : "https://xxx.xx/xxxx"
}
} ]
}
}
最佳答案
可能Ajax没有从URL传递凭据。通过HTTP header 附加auth,如下所示:How to use Basic Auth with jQuery and AJAX?
关于ajax - Bonsai Elasticsearch附加组件:401未经授权的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44734567/
为了部署使用Elasticsearch的firebase应用程序,我正在使用Heroku Bonsai附加组件。 一切都准备就绪,问题是我在传递Ajax请求时遇到了未经授权的错误。完全相同的代码在本地
我终于得到了elasticsearch不会在启动时崩溃我的应用程序,但是无论何时我尝试搜索该应用程序崩溃并添加新记录都会使该应用程序崩溃(但确实会添加记录)。 我收到的错误消息是: Professo
var star = document.getElementById("star"); var color = "#ef6360"; bonsai.run(star, { code: func
我正在尝试 ping 我的 Elasticsearch 实例(通过 Bonsai 和 Heroku 插件部署)。我遵循了他们的指导方针并尝试在我的计算机上执行以下代码: from elasticsea
Heroku 的这篇短文指出,无数客户端可用于集成到您的 Bonsai-es 实例。我已经尝试过 es-head 和弹性锤子,但没有成功。 “Bonsai 插件为您的应用程序提供了一个 Elastic
我在我的一个 Ruby on Rails 项目中使用 Elasticsearch - Bonsai。所以,到目前为止,事情进展得很顺利。但是,当我们向最终用户启动此应用程序并且人们开始进来时,我们注意
我遵循Heroku关于设置Bonsai Elasticsearch的指示: https://devcenter.heroku.com/articles/bonsai 所有这些都在我的Gemfile中:
在将我的 Jhipster 应用程序部署到 heroku 之后,我想将云 Elasticsearch (盆景)与 JHipster 一起使用。 Bonsai 提供以下环境变量: $BONSAI_URL
刚开始使用 Bonsai JS,在文档中找不到任何内容,所以我想在这里问一下。如何设置元素类属性以便在 CSS 中定义一些样式? Bonsai 直接支持大多数样式,但我还需要在悬停在元素上时更改光标类
构建我的第一个 Rails 应用程序并在让 Elasticsearch 在 Heroku 上运行时遇到问题。 本地工作完美。 在 Heroku 上我可以打开搜索页面,但是当我尝试执行搜索时出现以下错误
在过去的 4 周里,我一直在与 Bonsai 和 Elasticsearch 进行一场失败的战斗,这在某种程度上令人沮丧,因为几个月前我在另一个应用程序上工作。 我的应用程序崩溃了,当我转到 Hero
我已经开始使用 Heroku 的 ElasticSearch 插件,Bonsai。我想在我的网站上为多个类别创建一个后端搜索。由于这是一个仅限后端的服务,并且可能包含敏感信息,我如何将连接到 Hero
我有一个 Java 应用程序使用 ElasticSearch API 连接到 Heroku 上的 Bonsai。将我的应用程序部署到 Heroku 后,我发现无法通过 TransportClient
我想找到并学习一个 js 库,它允许我对在 Illustrator 中创建的 SVG 文件进行动画处理。我在 After Effects 和动态图形方面拥有丰富的背景,因此我正在寻找一个能够为我提供大
感谢手电筒的教程https://github.com/firebase/flashlight , 这在某种程度上很容易用 Firebase 进行全文搜索。 但是,如果您保留免费的 ES 实例,它会在并
我对 js 还是个新手,我正在尝试将 bonsai.js 放入主干应用程序中。 我在这里遵循本指南:https://github.com/iamdustan/bonsai-demos ,并尝试通过将动
我正在尝试为一个大型项目选择一个搜索工具,我很想知道 Solr 或 ElasticSearch 是否支持这个用例。 我的客户对进行相对复杂的 bool 搜索感兴趣。必须进行的一项搜索是能够使用词根扩展
当我运行时: $ heroku run bundle exec rake environment elasticsearch:import:model CLASS='Artist' FORCE=tru
我是一名优秀的程序员,十分优秀!