正如在 FullScale 的官方文档中看到的,我有:
// The official one
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
host: conf.elastic.server
});
// FullScale one (for some reasons, needing the official one, whereas in AngularJS, same version, used alone. But hey ! I'm not judging.
var ejs = require('elastic.js');
client.search({
index: conf.elastic.indice,
type: conf.elastic.index,
body: ejs.Request().query(ejs.BoolQuery().must(ejs.MatchQuery('field': 'exemple'))
}).then(function(resp) {
_this.sendResponse(null, resp.hits.hits, res);
}, function(args) {
console.trace("Erreur #" + args.status + " : " + args.error);
});
一切似乎都有效,除非我仔细观察与“示例”完全无关的结果,例如:
{
"field": "something that have absolutely nothing to do with anything"
},
{
"field": "lolwut i don't even know how to elasticsearch"
},
{
"field": "kthxbye"
}
elastic.js(全尺寸)在 npm 上是否损坏(因为我知道它在 AngularJS 上工作)?还是我忘记猜测 FullScale 文档中没有的内容?
谢谢。