I can't create mapping with python modukle elasticsearch

Hi,

I try to add a mapping with geocoding and date to my index with elasticsearch-py.

But my field "COORDONNEES" doesn't appear in mapping as geo_point but like type text with keywords. I want to use this this field in kibana map module .

I've no error and it seem update as a geopoint type but in kibana it doesn't.

The error message if i don't put the parameter [ ignore_malformed ]

elasticsearch.exceptions.RequestError: RequestError(400, 'mapper_parsing_exception', 'latitude must be a number')

Could you help me to solve it ?

Thanks a lot,

This is my script:

# Delete Old Index

ES.indices.delete(index=INDEX, ignore=[400, 404])

print('Index Delete')

# Create Index

ES.indices.create(index=INDEX, ignore=400)

print('Index Create')

# Mapping

print(ES.indices.put_mapping(index="datalake-customer", ignore=400, body=MAPPING1))

print('Add Mapping To Index')

resultmapping = ES.indices.get_mapping(index=INDEX)

print(u'%s' %

(resultmapping['datalake-customer']['mappings']['properties']['COORDONNEES']['type']))
# Upload CSV
i = 1
with open(CSVFILE) as f:
for line in csv.DictReader(f):
    ES.index(index=INDEX, id=i, body=line)
    i = i+1
print('Index Customer CMN indexed')
print('------------------')
print('Le nombre d\'objets ajoutés à ES est de ' + str(i))
resultmapping = ES.indices.get_mapping(index=INDEX)
print(u'%s' %
  (resultmapping['datalake-customer']['mappings']['properties']['COORDONNEES']['type']))

And this is my mapping:

MAPPING1 = '''
{
		"properties": {
			"customer": {
				"properties": {
					"ADRESSE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"AGENCE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"CODEPOSTAL": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"COMPLEMENTADRESSE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"COORDONNEES": {
						"type": "geo_point",
						"ignore_malformed": true
					},
					"DATENAISSANCE": {
						"type": "date"
					},
					"GENRE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"IDAGENCE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"IDCLIENT": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"IDEPARGNE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"IDESS": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"IDGAGE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"INSEECOMMUNE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"LIEUNAISSANCE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"MAIL": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"NATIONALITE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"NOM": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"NOMNAISSANCE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"NUMFISCAL": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"PRENOM": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"PROFESSION": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"RAISONSOCIALE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"SERVICES": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"SIRET": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"SITUATIONFAMILIALE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"STATUTCONTROLE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"STATUTNPAI": {
						"type": "boolean"
					},
					"TELEPHONEPRINCIPAL": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"TELEPHONESECONDAIRE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"TYPECLIENT": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					},
					"VILLE": {
						"type": "text",
						"fields": {
							"keyword": {
								"type": "keyword",
								"ignore_above": 256
							}
						}
					}
				}
			}
		}
	}
'''

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.