1

I'm using ES 7.14 / Kibana 7.10, my query is the following:

 var query = {
    "index": "my_index",
    "size": 10
};
var body = {
    "query": {
        "bool": {
            "must": [
                {
                    "query_string": {
                        "query": "*antonio* *banderas*",
                        "fields": [
                            "text"
                        ],
                        "default_operator": "and"
                    }
                }]
        }
    }
};
body.explain = false;
body.profile = true;
query.body = body;
const res = await client.search(query);

I have set to true the high-level profile flag to activate the Profile API, but I do not see the profile field in the response object res, where res holds an array of results:

[{
    _index: 'my_index',
    _type: '_doc',
    _id: 'my_doc_id',
    _score: 2,
    _source: {}
}]
loretoparisi
  • 15,724
  • 11
  • 102
  • 146

1 Answers1

0

Try to use this method : https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#_searchtemplate

or try with client.helpers

await client.helpers.search({
        index:indexName,
        body: esQuery
    });

there is no reason to not be returned expect an error within the api elasticsearch javascript

Bouraoui KACEM
  • 821
  • 1
  • 8
  • 20
  • Thanks, I'm using `client.search` as it's defined `elasticsearch@15.5.0` I expect it should work ok. There is any `helpers` object on the `client` object in the nodejs client. – loretoparisi Aug 23 '21 at 14:26