rico sam
rico sam

Reputation: 1

ElasticSearch action_request_validation_exception

I'm creating mapping for multiple type

here my query PUT opl_consultation/_mapping

my json mapping file {
"mappings": {

    "article": {     
    "properties": {        
        "numero_noeud": { "type": "text"   },
        "intitule_fr": { "type": "text"   },
        "path_audio": { "type": "text"   }
        }    
    },   

    "hierarchie": {      
        "properties": {       
            "id_type_noeud_hie": { "type": "integer"   },
            "noeud_numero_hie": { "type": "text"   },
            "intitule_hie_fr": { "type": "text"   }
        }
    },

    "law_type": {      
        "properties": {       
        "id_type_loi": { "type": "integer"   },
        "Desc_law_type": { "type": "text"   }
        }
    }

}

}

below the error a got "type": "action_request_validation_exception", "reason": "Validation Failed: 1: mapping type is missing;" }, "status": 400 }

the version is Elasticsearch\6.4.2

Upvotes: 0

Views: 13946

Answers (1)

ben5556
ben5556

Reputation: 3018

In Elasticsearch 6.4.2 you cannot have more than one mapping type. See https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html

If you run your query instead as PUT opl_consultation with your mapping definition you will get the below error

"type": "illegal_argument_exception",
    "reason": "Rejecting mapping update to [opl_consultation] as the final mapping would have more than 1 type: [law_type, article, hierarchie]"

Instead, use a custom type field as described here

Upvotes: 1

Related Questions