Describe the bug
Current cast-allocation index contains two string fields that are used for time range query:
data.begin_time
data.history.end_time
With elasticsearch 7.5.1+, time range queries on text fields do not work. These fields need to be mapped to date type.
It's possible that the index cast-allocation didn't have a customized mapping of data fields initially. So, filebeat reads the allocation records in csm_transaction log and puts them into elasticsearch indexes as text or string type.
This defect documents the procedure of loading a customized index mapping template for cast-allocation using the filebeat and curl commands.
To Reproduce
Steps to reproduce the behavior:
- Log in to a BDS node to access elasticsearch service (local or remote).
- Run
curl to display cast-allocation index mapping:
curl http://XX.X.X.XX:9200/cast-allocation/_mapping?pretty
- In the output, look for
begin_time and end_time
- Note that they are defined as
text, for example:
"begin_time" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
Expected behavior
Those date fields should be defined as date, for example:
"begin_time" : {
"type" : "date"
},
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- Machine [CSM BDS, IST BDS clusters]
- Version [CSM 1.8.2]
Additional context
With these fields changed to date type, the date format to be written into them needs to have correct format as well. See #992.
Issue Source:
Beside addressing the index mapping issue, the procedure of how to use the filebeat command to load customized mapping template should be in CSM BDS readthedoc for when there's need in the future.