Value ( 1.0. ) ( Notice the last dot after 0 ) getting stored as type Date in Elastic search

We store logs data in Elasticsearch we have added functionality which makes the JSON logs stored in Elasticsearch as seperate fields.
In one of the logs appVersion value was coming as - ( 1.0. ) - Notice the last dot after 0
for this value Elasticsearch interpreted as date as stored the value as - 'Jan 1, 1970 @ 05:30:00.001'

But if the appVersion value is ( 1.0.0 ) - Notice no dot at the end , then the value is stored properly

What should we do for this problem
appVersion getting stored as date when the appVersion value is ( 1.0. )

appVersion getting stored as version properly when the appVersion value is ( 1.0.0 )

Are you using dynamic mappings? Is it difficult to set the field mappings as text before indexing documents?

Yes using dynamic mapping.
Yeah actually to set mapping before indexing the documents, I don't know what fields it would be as we are consuming the calls and storing this to Elasticsearch.

As it is giving error for date, I am thinking of setting below mappings for date format
`PUT /qa-valid-date-format
{
"mappings": {
"dynamic_date_formats": ["yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"]
}
}

which is working for the sample index.
but the indexes what are already created I tried setting mapping I am getting below error

{
"error" : {
"root_cause" : [
{
"type" : "cluster_block_exception",
"reason" : "index [qa-2022-07-01] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-02] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-03] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-04] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-05] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-06] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-06-30] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];"
}
],
"type" : "cluster_block_exception",
"reason" : "index [qa-2022-07-01] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-02] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-03] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-04] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-05] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-07-06] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];index [qa-2022-06-30] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];"
},
"status" : 429
}```

Using dynamic_date_formats or dynamic templates are good for you.

You have to reindex indices to change existing mappings. It could not be updated within existing index.

Yes that is solution to reIndex that data, but new data is still coming with appVersion:1.0.
can you please list down step how can I have achieve it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.