2017-05-02 4 views
0

Vielen Dank im Voraus!Upload Index Vorlage zu AWS Elasticsearch Service

Ich habe Google erschöpft!

Grundsätzlich möchte ich eine Index-Vorlage JSON-Datei zu AWS Elasticsearch Service hochladen, wie gehe ich dabei vor? Wohin geht es?

Hier ist das Tutorial, das ich befolge, das nicht sehr beschreibend ist! https://www.fernandobattistella.com.br/log_processing/2016/03/13/Cloudtrail-S3-Lambda-Elasticsearch.html

+0

sprechen Sie über die 'PUT' Anfrage im Tutorial? –

+0

Ja, das ist richtig, die PUT & die folgenden JSON –

Antwort

2

Ganz einfach laufen und das sollte es tun:

curl -XPUT http://search-xxxxxxxxxxxxx.ap-xxxxxxx-1.es.amazonaws.com/_template/logstash -d '{ 
    "template" : "logstash-*", 
    "settings" : { 
    "index.refresh_interval" : "5s" 
    }, 
    "mappings" : { 
    "_default_" : { 
     "_all" : {"enabled" : true, "omit_norms" : true}, 
     "dynamic_templates" : [ { 
     "message_field" : { 
      "match" : "message", 
      "match_mapping_type" : "string", 
      "mapping" : { 
      "type" : "string", "index" : "analyzed", "omit_norms" : true, 
      "fielddata" : { "format" : "enabled" } 
      } 
     } 
     }, { 
     "string_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "string", 
      "mapping" : { 
      "type" : "string", "index" : "analyzed", "omit_norms" : true, 
      "fielddata" : { "format" : "enabled" }, 
      "fields" : { 
       "raw" : {"type": "string", "index" : "not_analyzed", "doc_values" : true, "ignore_above" : 256} 
      } 
      } 
     } 
     }, { 
     "float_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "float", 
      "mapping" : { "type" : "float", "doc_values" : true } 
     } 
     }, { 
     "double_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "double", 
      "mapping" : { "type" : "double", "doc_values" : true } 
     } 
     }, { 
     "byte_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "byte", 
      "mapping" : { "type" : "byte", "doc_values" : true } 
     } 
     }, { 
     "short_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "short", 
      "mapping" : { "type" : "short", "doc_values" : true } 
     } 
     }, { 
     "integer_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "integer", 
      "mapping" : { "type" : "integer", "doc_values" : true } 
     } 
     }, { 
     "long_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "long", 
      "mapping" : { "type" : "long", "doc_values" : true } 
     } 
     }, { 
     "date_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "date", 
      "mapping" : { "type" : "date", "doc_values" : true } 
     } 
     }, { 
     "geo_point_fields" : { 
      "match" : "*", 
      "match_mapping_type" : "geo_point", 
      "mapping" : { "type" : "geo_point", "doc_values" : true } 
     } 
     } ], 
     "properties" : { 
     "@timestamp": { "type": "date", "doc_values" : true }, 
     "@version": { "type": "string", "index": "not_analyzed", "doc_values" : true }, 
     "geoip" : { 
      "type" : "object", 
      "dynamic": true, 
      "properties" : { 
      "ip": { "type": "ip", "doc_values" : true }, 
      "location" : { "type" : "geo_point", "doc_values" : true }, 
      "latitude" : { "type" : "float", "doc_values" : true }, 
      "longitude" : { "type" : "float", "doc_values" : true } 
      } 
     } 
     } 
    } 
    } 
}' 
+0

Hey vielen Dank für die Rückmeldung an mich! Was macht das genau? Und was ist mit der JSON-Vorlage, die im Tutorial bereitgestellt wird? –

+0

Ich habe nicht den gesamten JSON in meine Antwort aufgenommen (siehe die Ellipse?) – Val

+0

Das wird eine Indexvorlage erstellen, so dass beim nächsten Erstellen eines neuen Dokuments in einem Index, dessen Name mit 'logstash-' beginnt, ein Index erstellt wird mit den Vorlageneinstellungen und -zuordnungen erstellt werden. Sehen Sie hier für mehr Informationen über Indexvorlagen: https://www.elastic.co/guide/en/elasticsearch/reference/5.3/indices-templates.html – Val

0

Wenn jemand anderes kommt in diesem Zusammenhang die Kibana Schnittstelle eine Konsole in dev-Tools auf der linken Seite, wo Sie in der PUT einfügen JSON und führen Sie es, sollten Sie eine quittierte Meldung im rechten Fenster

die URL erhalten sollte wie folgt aussehen - https://search-XXXX.eu-west-1.es.amazonaws.com/_plugin/kibana/app/kibana#/dev_tools/console?_g=()

+1

Nicht wirklich eine Antwort auf Ihre Frage, aber cool, wenn Sie es geschafft haben. – Val

+0

Nun, eigentlich war es so, dass Sie einen Index in den aws elasticsearch service hochladen. Anstatt die Datei hochzuladen, fügen Sie die Jason in die kibana-Oberfläche ein! Vielleicht bei einer normalen elastischen Suchinstanz machst du es so, wie ich es nicht sagen kann! Danke für Ihre Hilfe! –

+1

Meine Antwort verwendet curl, deins verwendet Kibana, der gemeinsame Punkt zwischen beiden Lösungen ist, dass Sie die HTTP REST API durchlaufen müssen, um mit AWS ES zu interagieren :-) – Val