0

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 のドキュメントにないものを推測するのを忘れましたか?

ありがとう。

4

1 に答える 1

0

何らかの理由で、次のように toString メソッドを使用する必要があります。

var body = ejs.Request().query(ejs.BoolQuery().must(ejs.MatchQuery('field': 'exemple'))

client.search({
    index: conf.elastic.indice,
    type: conf.elastic.index,
    body: body.toString()
}).then(...);

そして、それは機能します。

その理由を実際に説明できる人がいる場合は、開いたままにします。とにかくありがとう。

于 2014-04-01T08:44:40.550 に答える