Skip to content

Instantly share code, notes, and snippets.

@nik9000
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nik9000/9528170 to your computer and use it in GitHub Desktop.
Save nik9000/9528170 to your computer and use it in GitHub Desktop.
Benchmark suggest
#!/bin/bash
function benchmark() {
echo -n "$1"
echo '
{
"size": 0,
"suggest": {
"text": "'$2'",
"title": {
"phrase": {
"field": "title",
"size": 1,
"max_errors": 2,
"confidence": 2,
"direct_generator": [
{
"field": "title",
"suggest_mode": "always",
"max_term_freq": 0.5
}
]
}
}
}
}' > request_body
ab -c 3 -n 200 -p request_body http://localhost:9200/test/_search 2>&1 | grep Total:
}
benchmark 'Short ' 'unitedd'
benchmark 'Nobel ' 'noble prize'
benchmark 'Medium ' 'united states house of representatives'
benchmark 'Long ' 'united states house of representatives elections in washington 2006'
benchmark '1 ' 'Credit card with lowest interest rate'
benchmark '2 ' 'list of the cities in missouri'
benchmark '3 ' 'pressure & ventilation system normal standard pressure value in pascal'
benchmark '4 ' 'Queen Elizabeth I of England belongs to which dynasty'
benchmark 'Troll ' 'united states united states united states united states united states united states just trolling'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment