Error in bulk request : [arg] cannot be changed from type [long] to [float] Error in bulk request : [arg] cannot be changed from type [long] to [float] elasticsearch elasticsearch

Error in bulk request : [arg] cannot be changed from type [long] to [float]


So, after some time I found a solution to my problems : Dynamic templates and Index templates

I actually had trouble with ElasticSearch not recognizing some types of fields (like date or geo_point), so I forced them for specifically named fields with help of templates.

If you want an example of my configuration in FOSElastica (doc is here) :

fos_elastica:    serializer:         serializer: jms_serializer    clients:        default:             host: localhost             port: 9200    index_templates: # https://www.elastic.co/guide/en/elasticsearch/reference/6.8/indices-templates.html        base_template: # this is a custom name for the index template            client: default            template: "*" # this is where you define which indices will use this template            types:                _doc: # this is where you define which types will use this (_doc stands for every type/documents)                    dynamic_templates: # https://www.elastic.co/guide/en/elasticsearch/reference/6.8/dynamic-templates.html                        dynamic_date_template: # this is a custom name for the dynamic field template                            match_pattern: regex                            match: created|updated|tpq_date|taq_date                            mapping:                                type: date                        dynamic_location_template:                            match: location                            mapping:                                type: geo_point


Elasticsearch will create a mapping depending on the first document it indexes if you do not provide one. Try checking the _mapping of your index. You can specify a mapping on your own in order to avoid this.