Hello,
recently I have been running into an issue with elastic.
I have a single node Elasticsearch-Container running in Docker.
Sometimes it seems that Elasticsearch is not running as it should so I have tried to debug it using kibana.
In case (case 1) it runs properly, the following queue
GET /trend_meta/_search
{
"query": {
"constant_score": {
"filter": {
"term": {
"id": "trend9d27baa7-7dbe-4448-891a-814cab9e805f"
}
}
}
}
}
results in this response:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1,
"hits": [
{
"_index": "trend_meta",
"_id": "trend9d27baa7-7dbe-4448-891a-814cab9e805f",
"_score": 1,
"_source": {
"id": "trend9d27baa7-7dbe-4448-891a-814cab9e805f",
"liveTime": 60,
"legend": {
"legendType": "Top",
"column": 3
},
"labelIt": [
{
"languageTag": "en",
"text": "Trend 01"
}
]
}
}
]
}
}
if it is not working properly (case 2), the response is:
{
"took": 0,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
If I would use "_id": "trend9d27baa7-7dbe-4448-891a-814cab9e805f" instead of "id": "trend9d27baa7-7dbe-4448-891a-814cab9e805f" in the search query, the response would be as expected (like the response of case 1), no matter if the Elasticsearch is running well or with issues.
The key _id is the id given from Elasticsearch. The key id is a key I defined.
GET /_template/trend_meta
response:
{
"trend_meta": {
"order": 0,
"index_patterns": [
"trend_meta"
],
"settings": {},
"mappings": {
"properties": {
"id": {
"type": "keyword"
}
}
}, "aliases": {}
}
}
My problem is that my code does not allow me to use the key _id instead of id. Somehow there seem to be cases when the key id is available but not accessible.
Have you run into the same issue before and have you been able solve it?