2014-11-28 7 views
5

Parsen Ich habe einen Fluss auf meinem lokalen Instanz von ES 1.3.4 und JDBC für MySQL 1.3.4.4Elasticsearch PutMapping API: MapperParsingException Root-Typzuordnung nicht leer nach

Dieser Fluss arbeitet gut und Daten in ES importieren. Problem Ich stehe vor dem, dass eines meiner Felder ein Textfeld ist und Leerzeichen enthält. Zum Beispiel "Echtzeit-Rechner". ES indiziert es als 'real', 'time' und 'calculator' anstelle von 'Real Time Calculator'.

Ich schaffe Mapping So unter Verwendung erwähnt JSON:

{ 
    "sale_test": { 
     "properties": { 
      "Client": { 
       "index": "not_analyzed", 
       "type": "string" 
      }, 
      "OfferRGU": { 
       "type": "long" 
      }, 
      "SaleDate": { 
       "format": "dateOptionalTime", 
       "type": "date" 
      }, 
      "State": { 
       "type": "string" 
      } 
     } 
    } 
} 

und Befehl:

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

Aber ich bin unten genannten Fehler bekommen:

> {"error":"MapperParsingException[Root type mapping not empty after 
> parsing! Remaining fields: [sale_test : 
> {properties={Client={type=string, index=not_analyzed}, 
> OfferRGU={type=long}, SaleDate={type=date, format=dateOptionalTime}, 
> State={type=string}}}]]","status":400} 

Wenn ich versuche, Zeigen Sie das aktuelle Mapping mit dem folgenden Befehl an:

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

ich nur dies: {}

Vielen Dank für Ihre Hilfe.

Antwort

7

Ihre Art ist nicht konsistent, in der API-Aufruf der Typ my_type ist

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

dann sale_test im JSON-Nachricht wird.

eine konsistente Art zu haben Ihr Problem zu beheben:

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" } 
     } 
     } 
    }' 

Hier haben Sie sowohl ein neuen Index und ein neue Art:

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

Korrektur des Index und Typ gibt mir:

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" 
      } 
     } 
     } 
    } 
    } 
} 
+1

Danke. Dies war Tippfehler. Ich habe das Mapping und nach dem Lesen der Dokumentation zur Elastic Search erkannte ich, dass wir das Mapping für einen bereits erstellten Index nicht aktualisieren können. Wir müssen zuerst die vorherige Zuordnung löschen und dann eine neue Zuordnung für diesen Index erstellen. Wenn es einen anderen Weg gibt, bitte teilen. Vielen Dank. –

Verwandte Themen