Repository navigation
Closed as not planned
Labels
bugSomething isn't working
Description
What is the bug?
Date formats are not formatted for nested type.
How can one reproduce the bug?
Steps to reproduce the behavior:
- Load mappings file:
{
"mappings": {
"properties": {
"message": {
"type": "nested",
"properties": {
"info": {
"type": "keyword",
"index": "true"
},
"author": {
"type": "keyword",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"index": "true"
},
"dayOfWeek": {
"type": "long"
},
"date": {
"type": "date",
"format": "date"
},
"time": {
"type": "date",
"format": "hour_minute_second"
},
"timestamp": {
"type": "date",
"format": "date_time"
}
}
},
"comment": {
"type": "nested",
"properties": {
"data": {
"type": "keyword",
"index": "true"
},
"likes": {
"type": "long"
}
}
},
"myNum": {
"type": "long"
},
"someField": {
"type": "keyword",
"index": "true"
}
}
}
}
- Load data
{"index":{"_id":"1"}}
{"message":{"info":"a","author":"e","dayOfWeek":1,"date":"1984-04-12","time":"08:47:52","timestamp":"1984-04-12T08:47:52.000Z"},"comment":{"data":"ab","likes":3},"myNum":1,"someField":"b"}
{"index":{"_id":"2"}}
{"message":{"info":"b","author":"f","dayOfWeek":2,"date":"2023-05-30","time":"06:50:16","timestamp":"2023-05-30T06:50:16.000Z"},"comment":{"data":"aa","likes":2},"myNum":2,"someField":"a"}
{"index":{"_id":"3"}}
{"message":{"info":"c","author":"g","dayOfWeek":1,"date":"1974-12-11","time":"01:25:02","timestamp":"1974-12-11T01:25:02.000Z"},"comment":{"data":"aa","likes":3},"myNum":3,"someField":"a"}
{"index":{"_id":"4"}}
{"message":[{"info":"c","author":"h","dayOfWeek":4,"date":"1995-03-17","time":"08:24:02","timestamp":"1995-03-17T08:47:52.000Z"},{"info":"a","author":"i","dayOfWeek":5,"date":"2009-03-17","time":"11:58:08","timestamp":"2009-03-17T11:58:08.000Z"}],"comment":{"data":"ab","likes":1},"myNum":4,"someField":"b"}
{"index":{"_id":"5"}}
{"message": [{"info":"zz","author":"zz","dayOfWeek":6,"date":"2015-03-03","time":"06:51:55","timestamp":"2015-03-03T06:51:55.000Z"}],"comment":{"data":["aa","bb"],"likes":10},"myNum":[3,4],"someField":"a"}
- Run the query
SELECT nested(message.timestamp) FROM nested_date - See result:
+--------------------------+
| nested(message.timestamp)|
|--------------------------|
| 1984-04-12T08:47:52.000Z |
| 2023-05-30T06:50:16.000Z |
| 1974-12-11T01:25:02.000Z |
| 1995-03-17T08:47:52.000Z |
| 2009-03-17T11:58:08.000Z |
| 2015-03-03T06:51:55.000Z |
+--------------------------+
What is the expected behavior?
It should format the date string based on the format specified in the mappings file. Result should be:
+---------------------+
| message.timestamp |
|---------------------|
| 1984-04-12 08:47:52 |
| 2023-05-30 06:50:16 |
| 1974-12-11 01:25:02 |
| 1995-03-17 08:47:52 |
| 2015-03-03 06:51:55 |
+---------------------+
What is your host/environment?
- Version 2.8
Do you have any additional context?
Root cause may be that nested function gets data from the hits and ignores parsing of date string.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity