You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following is a simple script that tests if Elasticsearch can index values formatted using those patterns out of the box (script available also here).
#!/bin/bash
ES=http://localhost:9200
functiondelete_index() {
curl -X DELETE "${ES}/test"
}
functionrefresh() {
curl -X POST "${ES}/_refresh"
}
functionindex_document() {
echo"Testing $1"
curl -X POST "${ES}/test/1" -d "{\"date\": \"$1\" }"
}
functionmapping() {
curl -X GET "${ES}/test/_mapping?pretty"
}
# test formats: "yyyy-MM-dd'T'HH:mm:ss.SSSSSSZ||yyyy-MM-dd'T'HH:mm:ssZ"foriin 2014-01-17T15:57:22.123456Z 2014-01-17T15:57:22Z
do
delete_index
index_document $i
mapping
refresh
done
We can see below the values are correctly indexed. I think it makes sense to add only those custom formats that are not indexed by default (this means we are declaring we expect those format). When declaring formats that are indexed out of the box I wonder if this can contribute to later confusion ("Did we have issues indexing those values? What kind of issues?").
Yea, it is possible that it was needed in some earlier ES versions. It is not needed now [1.7.x - 5.0.x] and it may change in the future again.
May be the best thing to do would be to remove these specific date formats from index templates AND at the same time make sure we have some tests in place that verifies it is able to correctly index data with couple of such date strings OOB. Not sure where to put such tests at this moment (somewhere into openshift/origin-aggregated-logging?). But I think it should be part of Common Data Model introduction effort.
Currently, we are specifying custom date formats for some date fields in index templates, like:
The following is a simple script that tests if Elasticsearch can index values formatted using those patterns out of the box (script available also here).
We can see below the values are correctly indexed. I think it makes sense to add only those custom formats that are not indexed by default (this means we are declaring we expect those format). When declaring formats that are indexed out of the box I wonder if this can contribute to later confusion ("Did we have issues indexing those values? What kind of issues?").
Results for Elasticsearch:
v1.7.2
v2.3.5
v2.4.0
v5.0.0-alpha5
The text was updated successfully, but these errors were encountered: