Cómo crear un ElasticSearch Índice de curvatura

0

Pregunta

Tengo la siguiente consulta para crear un índice:

curl -X PUT "http://localhost:9200/my-index-000002?pretty" -H 'Content-Type: application/json' -d'
{
   "mappings": {
      "athlete": {
         "properties": {
          "birthdate": {
           "type": "date",
           "format": "dateOptionalTime"
           },
           "location": {
               "type": "geo_point"
            },
            "name": {
               "type": "string"
            },
            "rating": {
             "type": "integer"
          },
          "sport": {
             "type": "string"
          }
        }
     }
   }
}'

Recibo el siguiente error:

{
  "error": {
   "root_cause": [
   {
     "type": "mapper_parsing_exception",
     "reason": "Root mapping definition has unsupported parameters:  [athlete : {properties={birthdate={format=dateOptionalTime, type=date}, name={type=string}, rating={type=integer}, location={type=geo_point}, sport={type=string}}}]"
   }
  ],
  "type": "mapper_parsing_exception",
  "reason": "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [athlete : {properties={birthdate={format=dateOptionalTime, type=date}, name={type=string}, rating={type=integer}, location={type=geo_point}, sport= {type=string}}}]",
  "caused_by": {
  "type": "mapper_parsing_exception",
  "reason": "Root mapping definition has unsupported parameters:  [athlete : {properties={birthdate={format=dateOptionalTime, type=date}, name={type=string}, rating={type=integer}, location={type=geo_point}, sport={type=string}}}]"
}
},
"status": 400
}

Creo que mi sintaxis para crear el índice es incorrecta. Agradecido por cualquier perspectiva. Gracias

elasticsearch
2021-11-22 17:33:06
1

Mejor respuesta

1

Simplemente quite athlete como no hay ninguna necesidad de cualquier tipo de asignación de nombre nada más, el resto está muy bien:

curl -X PUT "http://localhost:9200/my-index-000002?pretty" -H 'Content-Type: application/json' -d'
{
   "mappings": {                     
                                      <---- remove this line
         "properties": {
          "birthdate": {
           "type": "date",
           "format": "dateOptionalTime"
           },
           "location": {
               "type": "geo_point"
            },
            "name": {
               "type": "string"
            },
            "rating": {
             "type": "integer"
          },
          "sport": {
             "type": "string"
          }
        }
   }
}'
2021-11-22 17:34:48

Gracias. Que además he cambiado de cadena de texto. gracias
Timothy Clotworthy

Genial, me alegro de que ayudó a!
Val

En otros idiomas

Esta página está en otros idiomas

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Slovenský
..................................................................................................................