I'm throwing some arbitrary data into elasticsearch (logs). The writes are happening fine, and most queries work properly, but I have a "reqId" field that never matches.
$ curl localhost:9200/log_general/log/c9811a1a-6710-424a-b67d-d02d6ad75c89 | jq .
{
"_index": "log_general",
"_type": "log",
"_id": "c9811a1a-6710-424a-b67d-d02d6ad75c89",
"_version": 1,
"found": true,
"_source": {
"body": {
"body": {
"media": [],
"parentId": "5a695c7bda3c26391649e332",
"text": "Super bulk comment 25"
},
"method": "post",
"url": "/addComment",
"xuserid": "5a695c30da3c26391649e17f"
},
"logType": "request_start",
"reqId": "5T42Q1AUmd9LS1E8Q",
"reqUrl": "/addComment"
}
}
I can try searching for it by reqId
curl -XPOST localhost:9200/_search -H 'content-type: application/json' --data-binary @sample-query
sample-query:
{
"query": {
"bool": {
"must": [
{
"term": {
"reqId": "5T42Q1AUmd9LS1E8Q"
}
}
],
"filter": [],
"should": []
}
}
}
Gives no hits, and no error.
If I try a different field, it returns results. Two of the results have the same reqId.
{
"query": {
"bool": {
"must": [
{
"term": {
"logType": "request_start"
}
}
],
"filter": [],
"should": []
}
}
}
This is the mapping elasticsearch generated for the two fields
"logType": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"reqId": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
Really no idea what the issue could be here.
reqId: { type: 'keyword' }, and now it's working. Would still love any ideas as to what the problem could be.