Skip to content

Hits object does not appear in the response body after the search function #1809

@simaybocu

Description

@simaybocu

We have an integration that we created using the Elasticsearch library.
In this integration; I am using a function in which I send a body to the location with type "_doc" in the "elastic-search" directory on the server and perform a search.
When I used the function as below, hits object was returned in response, but now hits object is not returned in response.body.

const body = {"from":0,"size":"10","query":{"bool":{"must":[{"match":{"appname":"mobilepos"}},{"match":{"userid":"111401336"}},{"match":{"timestamp":"2023-01-10”}},{“match":{"hotelrefno":"999984"}}]}}}

search: (body, requestInfo) => {
    return client.search({index: “elastic-search”, type: “_doc”, body: body})
        .then(response => {
            others.successMessage(requestInfo);
            return {
                  status: response.statusCode,
                  total: response.body.hits.total.value,
                  data: response.body.hits.hits
            };
        })
        .catch(error => {
            return others.errorHandling(error, requestInfo);
        });
}

There is no hits object in the response returned from above

@elastic/elasticsearch - npmver: 7.13.3

Could you please help me? why, what should I edit or check?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions