Skip to content

Instantly share code, notes, and snippets.

@mauriciofs
Created February 8, 2017 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauriciofs/3cbe65b64acba2b0e199a4e59e0809d8 to your computer and use it in GitHub Desktop.
Save mauriciofs/3cbe65b64acba2b0e199a4e59e0809d8 to your computer and use it in GitHub Desktop.
My mapping template is defined this way for the above field:
curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: c5cae459-7bcb-55fa-ad4d-593aa5a5c289" -d '{
"template" : "journeys-*",
"settings" : {
},
"mappings": {
"journeys": {
"include_in_all": false,
"properties": {
"company_id": {
"type": "integer",
"include_in_all": false
},
"created_at": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss",
"include_in_all": false
},
"distance_km": {
"type": "double",
"include_in_all": false
},
"driver_id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"end_date_time": {
"type": "date",
"ignore_malformed": true,
"format": "yyyy-MM-dd HH:mm:ss",
"include_in_all": false
},
"end_date": {
"type": "date",
"ignore_malformed": true,
"format": "yyyy-MM-dd",
"include_in_all": false
},
"end_time": {
"type": "date",
"ignore_malformed": true,
"format": "HH:mm:ss",
"include_in_all": false
},
"start_date": {
"type": "date",
"ignore_malformed": true,
"format": "yyyy-MM-dd",
"include_in_all": false
},
"start_time": {
"type": "date",
"ignore_malformed": true,
"format": "HH:mm:ss",
"include_in_all": false
},
"idling_points": {
"include_in_all": false,
"type": "nested",
"properties": {
"end": {
"include_in_all": false,
"type": "nested",
"properties": {
"acquisition_time": {
"type": "date",
"include_in_all": false,
"ignore_malformed": true
},
"location": {
"type": "geo_point",
"include_in_all": false,
"ignore_malformed": true
}
}
},
"start": {
"type": "nested",
"include_in_all": false,
"properties": {
"acquisition_time": {
"type": "date",
"include_in_all": false
},
"location": {
"type": "geo_point",
"include_in_all": false
}
}
}
}
},
"idling_time_secs": {
"type": "integer",
"include_in_all": false
},
"journey_time_secs": {
"type": "integer",
"include_in_all": false
},
"journeys_per_hour": {
"type": "nested",
"include_in_all": false,
"properties": {
"distance_km": {
"type": "double",
"include_in_all": false
},
"driver_id": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"end_date_time": {
"type": "date",
"ignore_malformed": true,
"format": "yyyy-MM-dd HH:mm:ss",
"include_in_all": false
},
"idling_points": {
"type": "nested",
"include_in_all": false,
"properties": {
"end": {
"include_in_all": false,
"properties": {
"acquisition_time": {
"type": "date",
"include_in_all": false
},
"location": {
"type": "geo_point",
"include_in_all": false
}
}
},
"start": {
"include_in_all": false,
"properties": {
"acquisition_time": {
"type": "date",
"include_in_all": false
},
"location": {
"type": "geo_point",
"include_in_all": false
}
}
}
}
},
"idling_time_secs": {
"type": "integer",
"include_in_all": false
},
"journey_time_secs": {
"type": "integer",
"include_in_all": false
},
"speed_average_kph": {
"type": "double",
"include_in_all": false
},
"speed_max_kph": {
"type": "double",
"include_in_all": false
},
"start_date_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss",
"include_in_all": false,
"ignore_malformed": true
},
"start_location": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"start_point": {
"include_in_all": false,
"type": "geo_point"
},
"stop_location": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"stop_point": {
"include_in_all": false,
"type": "geo_point"
}
}
},
"speed_average_kph": {
"type": "double",
"include_in_all": false
},
"speed_max_kph": {
"type": "double",
"include_in_all": false
},
"start_date_time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss",
"include_in_all": false
},
"start_location": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"start_location_group":{
"type": "string",
"include_in_all": false,
"index": "not_analyzed"
},
"start_location_name":{
"type": "string",
"include_in_all": false,
"index": "not_analyzed"
},
"start_point": {
"type": "geo_point"
},
"stop_location": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
},
"stop_location_group": {
"type": "string",
"include_in_all": false,
"index": "not_analyzed"
},
"stop_location_name": {
"type": "string",
"include_in_all": false,
"index": "not_analyzed"
},
"stop_point": {
"include_in_all": false,
"type": "geo_point"
},
"tracker_id": {
"type": "string",
"include_in_all": false
},
"tracker_uid": {
"type": "integer",
"include_in_all": false
},
"vehicle_id": {
"type": "integer",
"include_in_all": false
},
"vehicle_details": {
"include_in_all": false,
"properties": {
"registration": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"description": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"model": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"fuel_type": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"label": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"icon": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"label_color": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"type": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"make": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
}
}
},
"driver_details": {
"include_in_all": false,
"properties": {
"driver_id": {
"include_in_all": false,
"type": "integer"
},
"name": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"contact_number": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
},
"driver_ibutton": {
"include_in_all": false,
"type": "string",
"index": "not_analyzed"
}
}
},
"start_week_day": {
"type": "integer",
"include_in_all": false
},
"end_week_day": {
"type": "integer",
"include_in_all": false
}
}
}
},
"aliases" : {}
}' "http://127.0.0.1:9200/_search"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment