How to define "target-throughput" in cmd line of custom track

hello i'm trying to make new custom track and just found how to write basic custom track

and i have question that how can i pass params from command line

for example, i want to set target-throuput on command line like
"esrally race --pipeline=benchmark-only --track-path=~/myCustomTrack/searchOps --target-throuput=1000"

im currently made which build params for match_all query.
And if there is some problem with my code let me know please .

def query_single_word(track, params, **kwargs):
    # choose a suitable index: if there is only one defined for this track
    # choose that one, but let the user always override index and type.
    target_throughput = params.get("target-throughput", 1000)
    if len(track.indices) == 1:
        default_index = track.indices[0].name
        if len(track.indices[0].types) == 1:
            default_type = track.indices[0].types[0].name
            default_type = None
        default_index = "text-index"
        default_type = None

    index_name = params.get("index", default_index)
    type_name = params.get("type", default_type)

    # you must provide all parameters that the runner expects
    return {
        "body": {
            "query": {
                "term": {
                    "body": "%s" % buildParamWithLength(4)
        "index": index_name,
        "type": type_name,
        "cache": params.get("cache", False)
def buildParamWithLength(leng):
    if wordList == []:
        raise Exception("param is null")
    param = ""
    for _ in range(leng):
        param += (random.choice(wordList) + " ")
    return param
def register(registry):
    registry.register_param_source("query_single_word-body", query_single_word)

Hello @dan_kim. Please use the --track-params command line parameter documented in Command Line Reference - Rally 2.7.0 documentation. Your example would look like this:

esrally race --pipeline=benchmark-only --track-path=~/myCustomTrack/searchOps --track-params=target-throughput:1000
1 Like

Thank you ! for your simple and complete answer

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.