diff --git a/night_rally/admin.py b/night_rally/admin.py index 3d8c6f2e9a425..3d7eee5c319db 100644 --- a/night_rally/admin.py +++ b/night_rally/admin.py @@ -165,9 +165,10 @@ def add_annotation(es, args): (message, environment, trial_timestamp, track, chart)) else: if not es.indices.exists(index="rally-annotations"): - body = open("%s/resources/annotation-mapping.json" % os.path.dirname(os.path.realpath(__file__)), "rt").read() + cwd = os.path.dirname(os.path.realpath(__file__)) + body = open(os.path.join(cwd, "resources", "annotation-mapping.json"), "rt").read() es.indices.create(index="rally-annotations", body=body) - es.index(index="rally-annotations", doc_type="type", body={ + es.index(index="rally-annotations", doc_type="_doc", body={ "environment": environment, "trial-timestamp": trial_timestamp, "track": track, @@ -187,7 +188,7 @@ def delete_annotation(es, args): else: for annotation_id in annotations: try: - es.delete(index="rally-annotations", doc_type="type", id=annotation_id) + es.delete(index="rally-annotations", doc_type="_doc", id=annotation_id) print("Successfully deleted [%s]." % annotation_id) except elasticsearch.TransportError as e: if e.status_code == 404: diff --git a/night_rally/resources/annotation-mapping.json b/night_rally/resources/annotation-mapping.json index a0e3aca4f6aaa..3880a9eed9c80 100644 --- a/night_rally/resources/annotation-mapping.json +++ b/night_rally/resources/annotation-mapping.json @@ -1,9 +1,9 @@ { + "settings": { + "number_of_shards": 1 + }, "mappings": { - "type": { - "_all": { - "enabled": false - }, + "_doc": { "dynamic_templates": [ { "strings": { @@ -19,7 +19,7 @@ "environment": { "type": "keyword" }, - "trial-timestamp": { + "race-timestamp": { "type": "date", "fields": { "raw": {