I wrote a script to load data to an elasticsearch instance using bulk helpers. It works great with simple mappings like this one:
{
"mappings": {
"*": {
"properties": {
"id": {"type": "long"},
"description": {"type": "text"},
"active": {"type": "boolean"}
}
}
}
}
But when I try using a nested mapping, it doesn't work right.
I have a data file with this header route|startDate|segmentStart|longitude|latitude
('|'
is the delimiter) and this mapping:
{
"mappings": {
"*": {
"properties": {
"route" : {"type": "text"},
"startDate" : {"type": "date"},
"points": {
"properties": {
"segmentStart": {"type": "integer"},
"longitude": {"type": "float"},
"latitude": {"type": "float"}
}
}
}
}
}
}
As you can see "points" has three properties "longitude", "latitude" and "segmentStart". But the mapping I see after uploading the data is this one:
{
"shape": {
"mappings": {
"*": {
"properties": {
"latitude": {"type": "text", "fields": {"keyword": {"type": "keyword", "ignore_above": 256}}},
"longitude": {"type": "text", "fields": {"keyword": {"type": "keyword", "ignore_above": 256}}},
"points": {
"properties": {
"latitude": {"type": "float"},
"longitude": {"type": "float"},
"segmentStart": {"type": "integer"}
}
},
"route": {"type": "text"},
"segmentStart": {"type": "text", "fields": {"keyword": {"type": "keyword", "ignore_above": 256}}},
"startDate": {"type": "date"}
}
}
}
}
}
And the data is clearly not uploaded in the way I need. Any ideas about what could be wrong?