Permalink
Browse files

add index settings (#409)

  • Loading branch information...
brechsteiner authored and Manuel Sabban committed Jan 18, 2018
1 parent 7c8aa9c commit 27926773968f972cd1228e20f380beea023c9801
Showing with 14 additions and 1 deletion.
  1. +2 −0 nxapi/nxapi.json
  2. +12 −1 nxapi/nxapi/nxparse.py
View
@@ -3,6 +3,8 @@
"host" : "127.0.0.1:9200",
"use_ssl" : false,
"index" : "nxapi",
"number_of_shards" : "4",
"number_of_replicas" : "0",
"doctype" : "events",
"default_ttl" : "7200",
"max_size" : "1000",
View
@@ -407,6 +407,12 @@ def set_mappings(self):
try:
self.es.indices.create(
index=self.cfg["elastic"]["index"],
body = {
"settings" : {
"number_of_shards": self.cfg["elastic"]["number_of_shards"],
"number_of_replicas": self.cfg["elastic"]["number_of_replicas"]
}
},
ignore=400 # Ignore 400 cause by IndexAlreadyExistsException when creating an index
)
except Exception as idxadd_error:
@@ -440,7 +446,12 @@ def set_mappings(self):
index=self.cfg["elastic"]["index"],
doc_type=self.cfg["elastic"]["doctype"],
# id=repo_name,
body={},
body = {
"settings" : {
"number_of_shards": self.cfg["elastic"]["number_of_shards"],
"number_of_replicas": self.cfg["elastic"]["number_of_replicas"]
}
},
ignore=409 # 409 - conflict - would be returned if the document is already there
)
except Exception as idxadd_error:

0 comments on commit 2792677

Please sign in to comment.