Skip to content

Instantly share code, notes, and snippets.

@nik9000
Created January 2, 2024 20:05
Show Gist options
  • Select an option

  • Save nik9000/bfd78dfa81e86db4b6e11d6450ba7867 to your computer and use it in GitHub Desktop.

Select an option

Save nik9000/bfd78dfa81e86db4b6e11d6450ba7867 to your computer and use it in GitHub Desktop.

Revisions

  1. nik9000 created this gist Jan 2, 2024.
    46 changes: 46 additions & 0 deletions no data.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    echo '{
    "settings": {
    "mapping.total_fields.limit": 10000,
    "number_of_shards": 10,
    "number_of_replicas": 0
    },
    "mappings": {
    "properties": {
    "f00000": {"type": "long"}' > /tmp/idx
    for f in {1..9999}; do printf ',
    "f%04d": {"type": "long"}' $f >> /tmp/idx;
    done
    echo '
    }
    }
    }' >> /tmp/idx


    for i in {0..99}; do
    printf "%02d: " $i;
    curl -XDELETE -uelastic:password localhost:9200/$(printf "idx%02d" $i);
    curl -XPUT -HContent-Type:application/json -uelastic:password localhost:9200/$(printf "idx%02d" $i) -d @/tmp/idx;
    echo;
    done

    while true; do
    time curl -XPOST -uelastic:password -HContent-Type:application/json localhost:9200/_query -d'{
    "query": "FROM *"
    }'
    done

    # Before:
    # [2024-01-02T14:43:40,607][INFO ][o.e.x.e.a.RestEsqlQueryAction] [runTask-0] Beginning execution of ESQL query.
    # Query string: [FROM *]
    # [2024-01-02T14:43:41,446][INFO ][o.e.x.e.a.EsqlResponseListener] [runTask-0] Failed execution of ESQL query.
    # Query string: [FROM *]
    # Execution time: [839]ms


    # After:
    # [2024-01-02T14:35:55,945][INFO ][o.e.x.e.a.RestEsqlQueryAction] [runTask-0] Beginning execution of ESQL query.
    # Query string: [FROM *]
    # [2024-01-02T14:35:56,085][INFO ][o.e.x.e.a.EsqlResponseListener] [runTask-0] Finished execution of ESQL query.
    # Query string: [FROM *]
    # Execution time: [140]ms