hello , I am trying to search nested .
I dont know what I am doing wrong .
MY MAPPING
{
"user-data-info": {
"mappings": {
"dynamic": "false",
"properties": {
"company": {
"type": "nested"
},
"timestamp": {
"type": "date",
"format": "yyyy-MM-dd"
}
}
}
}
}
GET user-data-info/_search
{
"query": {
"match_all": {}
}
}
RESULT - FOUND 1 RESULT
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "user-data-info",
"_id": "bb56iYkB8sgA-4K-OT_i",
"_score": 1,
"_source": {
"timestamp": "2023-06-01",
"company": {
"id": 1,
"name": "Nike"
}
}
}
]
}
}
SEACHING NESTED
GET /user-data-info/_search
{
"query": {
"nested": {
"path": "company",
"query": {
"bool": {
"must": [
{ "match": { "company.id": 1 } }
]
}
}
}
}
}
RESULT / FOUND 0
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}