Hilal
(Hilal)
October 20, 2016, 6:34am
1
Hi,
I indexed my mysql datas with ES but my "year" field mapping was wrong.
How do I update my mapping?
My mapping:
PUT my_index/my_type/_mapping
{
"properties" : {
"Year" : {
"type" : "date",
"format" : "yyyy-MM-dd"
}
The format was wrong. Actually it should be this way:
PUT my_index/my_type/_mapping
{
"properties" : {
"Year" : {
"type" : "date",
"format" : "yyyy"
}
What can I do?
dadoonet
(David Pilato)
October 20, 2016, 6:51am
2
You have to reindex.
But if you indexed your data already what is wrong then?
Can you explain why the current format you have does not suit your use case?
Hilal
(Hilal)
October 20, 2016, 7:03am
3
For example year = "2015
" but It was indexed format : yyyy-MM-dd.
It have to be format : yyyy
I get an error when I query:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Invalid format: \"2015\" is too short"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "titub",
"node": "93UU8PfmSR6TZQdClhmhIg",
"reason": {
"type": "illegal_argument_exception",
"reason": "Invalid format: \"2015\" is too short"
}
}
]
},
"status": 400
}
It indexed the total data size is 2.5 GB. Data takes too long to re-indexed. Because I carry the Elasticsearch technology from my MySQL data using PHP
dadoonet
(David Pilato)
October 20, 2016, 7:37am
4
How did you manage to index older data then if they were not using that format YYYY
?
Hilal
(Hilal)
October 20, 2016, 10:50am
5
you are right. Then the query may be incorrect.