in esrally/track/params.py [0:0]
def __init__(self, track, params, **kwargs):
super().__init__(track, params, **kwargs)
self.request_params = params.get("request-params", {})
self.index_definitions = []
if track.indices:
filter_idx = params.get("index")
if isinstance(filter_idx, str):
filter_idx = [filter_idx]
settings = params.get("settings")
for idx in track.indices:
if not filter_idx or idx.name in filter_idx:
body = idx.body
if body and settings:
if "settings" in body:
# merge (and potentially override)
body["settings"].update(settings)
else:
body["settings"] = settings
elif not body and settings:
body = {"settings": settings}
self.index_definitions.append((idx.name, body))
else:
try:
# only 'index' is mandatory, the body is optional (may be ok to create an index without a body)
idx = params["index"]
body = params.get("body")
if isinstance(idx, str):
idx = [idx]
for i in idx:
self.index_definitions.append((i, body))
except KeyError:
raise exceptions.InvalidSyntax("Please set the property 'index' for the create-index operation")