# Indexer Mongodb dans ES en temps réel

**URL:** <https://discuss.elastic.co/t/indexer-mongodb-dans-es-en-temps-reel/259190>\
**Category:** Elasticsearch\
**Created:** [December 20, 2020, 8:51am UTC](https://discuss.elastic.co/t/indexer-mongodb-dans-es-en-temps-reel/259190 "2020-12-20T08:51:27Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![Jalil](https://avatars.discourse-cdn.com/v4/letter/j/fbc32d/32.png) [@Jalil](https://discuss.elastic.co/u/Jalil)\
**Post date:** [December 21, 2020, 10:24pm UTC](https://discuss.elastic.co/t/indexer-mongodb-dans-es-en-temps-reel/259190/14 "2020-12-21T22:24:12Z")

</div>

J'ai essayé de créer un template mapping comme suit :  
est-ce la bonne manière ?

```auto
{
	"mappings": {
		"trips": {
			"properties": {
				"distance": {
					"type": "float"
				},
				"driver_id": {
					"type": "text",
					"fields": {
						"keyword": {
							"type": "keyword",
							"ignore_above": 256
						}
					}
				},
				"driver_name": {
					"type": "text",
					"fields": {
						"keyword": {
							"type": "keyword",
							"ignore_above": 256
						}
					}
				},
				"end": {
					"properties": {
						"address": {
							"properties": {
								"city": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								},
								"country": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								},
								"name": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								},
								"zipcode": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								}
							}
						},
						"in": {
							"properties": {
								"coordinates": {
									"type": "geo_point"
								},
								"name": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								}
							}
						},
						"place_name": {
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword",
									"ignore_above": 256
								}
							}
						},
						"stop": {
							"properties": {
								"duration": {
									"type": "long"
								},
								"ended_at": {
									"type": "date"
								},
								"idling": {
									"type": "long"
								},
								"idling_duration": {
									"type": "long"
								},
								"started_at": {
									"type": "date"
								}
							}
						}
					}
				},
				"ended_at": {
					"type": "date"
				},
				"fleet_id": {
					"type": "text",
					"fields": {
						"keyword": {
							"type": "keyword",
							"ignore_above": 256
						}
					}
				},
				"organization_id": {
					"type": "text",
					"fields": {
						"keyword": {
							"type": "keyword",
							"ignore_above": 256
						}
					}
				},
				"start": {
					"properties": {
						"address": {
							"properties": {
								"city": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								},
								"country": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								},
								"name": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								},
								"street": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								},
								"zipcode": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								}
							}
						},
						"in": {
							"properties": {
								"coordinates": {
									"type": "geo_point"
								},
								"name": {
									"type": "text",
									"fields": {
										"keyword": {
											"type": "keyword",
											"ignore_above": 256
										}
									}
								}
							}
						},
						"place_id": {
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword",
									"ignore_above": 256
								}
							}
						},
						"place_name": {
							"type": "text",
							"fields": {
								"keyword": {
									"type": "keyword",
									"ignore_above": 256
								}
							}
						},
						"stop": {
							"properties": {
								"duration": {
									"type": "long"
								},
								"ended_at": {
									"type": "date"
								},
								"idling": {
									"type": "long"
								},
								"idling_duration": {
									"type": "long"
								},
								"started_at": {
									"type": "date"
								}
							}
						}
					}
				},
				"started_at": {
					"type": "date"
				},
				"trip_duration": {
					"type": "long"
				},
				"updated_at": {
					"type": "date"
				},
				"vehicle_id": {
					"type": "text",
					"fields": {
						"keyword": {
							"type": "keyword",
							"ignore_above": 256
						}
					}
				},
				"vrn": {
					"type": "text",
					"fields": {
						"keyword": {
							"type": "keyword",
							"ignore_above": 256
						}
					}
				}
			}
		}
	}
}

```

---

_[View the full topic](https://discuss.elastic.co/t/indexer-mongodb-dans-es-en-temps-reel/259190)._
