2017-05-24 3 views
0

Ich habe Probleme mit dem Hochladen von Index in Elasticsearch.Mapping-Index Elasticsearch Timestamp benutzerdefinierte

curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym_error_timeline -d "{\"mappings\":{\"timestamp\":{\"type\":\"date\",\"format\":\"yyyy-MM-dd\"}}}" 

ich diesen Fehler:

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [format : yyyy-MM-dd] [type : date]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [timestamp]: Root mapping definition has unsupported parameters: [format : yyyy-MM-dd] [type : date]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters: [format : yyyy-MM-dd] [type : date]"}},"status":400} 

Warum ist mein curl Befehl falsch?

Danke.

+0

Mögliche Duplikat [Elasticsearch: Root Mapping-Definition hat den Index nicht unterstützte Parameter: nicht \ _analyzed] (https://stackoverflow.com/questions/39288997/elasticsearch -root-mapping-definition-has-nicht-unterstützt-Parameter-index-nicht-a) –

Antwort

1

Sie verpassen die Typdeklaration:

curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym_error_timeline -d '{ 
    "mappings":{ 
    "your_type_name": {    <--- add this 
     "properties": {    <--- and this 
      "timestamp":{ 
       "type":"date", 
       "format":"yyyy-MM-dd" 
      } 
     } 
     }   
    } 
}' 
+0

Sie haben Recht. In der Tat habe ich es in korrigiert: curl -H "Content-Typ: Anwendung/JSON" -XPUT http: // localhost: 9200/technogym_error_timeline-d "{\" Zuordnungen \ ": {\" _ Standard _ \ ": {\" Eigenschaften \ ": {\" Zeitstempel \ ": {\" Typ \ ": \" Datum \ ", \" Format \ ": \" JJJJ-MM-TT \ "}}}}}". Danke –

+0

Froh, dass es geholfen hat. – Val

Verwandte Themen