sql >> Base de Datos >  >> RDS >> Mysql

ElasticSearch PutMapping API:MapperParsingException La asignación de tipo raíz no está vacía después del análisis

Su tipo no es consistente, en la llamada a la API el tipo es my_type

curl -XPUT http://localhost:9200/my_index/_mapping/my_type

luego se convierte en sale_test en el mensaje JSON.

Tener un tipo consistente solucionará su problema:

curl -XPUT http://localhost:9200/my_index/_mapping/sale_test -d '
    { 
     "sale_test": { 
       "properties": { 
         "Client": {"type": "string", "index": "not_analyzed" }, 
         "OfferRGU": { "type": "long" }, 
         "SaleDate": { "type": "date", "format": "dateOptionalTime" },
         "State": { "type": "string" }
         } 
       } 
    }'

Aquí tienes tanto un nuevo índice y un nuevo tipo :

curl -XGET http://localhost:9200/dgses/sale_test_river/_mapping

Corregir el índice y el tipo me da:

curl -XGET http://localhost:9200/my_index/sale_test/_mapping?pretty
{
  "myindex" : {
    "mappings" : {
      "sale_test" : {
        "properties" : {
          "Client" : {
            "type" : "string",
            "index" : "not_analyzed"
          },
          "OfferRGU" : {
            "type" : "long"
          },
          "SaleDate" : {
            "type" : "date",
            "format" : "dateOptionalTime"
          },
          "State" : {
            "type" : "string"
          }
        }
      }
    }
  }
}