I have products index, and when I run a query in Dev Tools like so I see results:
GET /products/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"merchant.id": "1"
}
}
]
}
}
}
Result:
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 0.2876821,
"hits": [
{
"_index": "products",
"_id": "1",
"_score": 0.2876821,
"_source": {
"id": 1,
"status": "available",
"category": {
"id": 1,
"name": {
"en": "Pizza",
"ru": "Пицца",
"uz": "Pitsa"
}
}...
But when I run it with my nodejs app I see results with no hits
field at all:
const result = await esClient.search({
index: "products",
type: '_doc',
body: {
query: {
match_all: {
"merchant.id": merchantId
}
}
}
});
and the results here is:
{
"body": {
"_index": "products",
"_id": "_search",
"_version": 3,
"result": "updated",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 3,
"_primary_term": 1
},
"statusCode": 200,
"headers": {
"content-length": "147",
"content-type": "application/json",
"x-cloud-request-id": "ko0mcfl9R3yhhD8MlXj2jA",
"x-elastic-product": "Elasticsearch",
"x-found-handling-cluster": "85e169669237424cbe3a332acb8082b6",
"x-found-handling-instance": "instance-0000000000",
"date": "Sun, 21 Apr 2024 19:00:16 GMT"
},
"meta": {
"context": null,
"request": {
"params": {
"method": "POST",
"path": "/products/_doc/_search",
"body": "{\"query\":{\"match_all\":{\"merchant.id\":\"1\"}}}",
"querystring": "",
"headers": {
"user-agent": "elasticsearch-js/7.17.13 (darwin 23.3.0-arm64; Node.js v21.6.1)",
"x-elastic-client-meta": "es=7.17.13,js=21.6.1,t=7.17.13,hc=21.6.1",
"content-type": "application/json",
"content-length": "43"
},
"timeout": 30000
},
"options": {},
"id": 4
},
"name": "elasticsearch-js",
"connection": {
"url": "https://secret.us-east-2.aws.elastic-cloud.com/",
"id": "https://secret.us-east-2.aws.elastic-cloud.com/",
"headers": {},
"deadCount": 0,
"resurrectTimeout": 0,
"_openRequests": 0,
"status": "alive",
"roles": {
"master": true,
"data": true,
"ingest": true,
"ml": false
}
},
"attempts": 0,
"aborted": false
}
}
where on earth is hits
??? when i run this agains docker container on my local i see the results.