Skip to content

Instantly share code, notes, and snippets.

@cdahlqvist
Last active November 23, 2017 09:25
Show Gist options
  • Save cdahlqvist/2b00bd007661d1982d0e7fed8eeaefae to your computer and use it in GitHub Desktop.
Save cdahlqvist/2b00bd007661d1982d0e7fed8eeaefae to your computer and use it in GitHub Desktop.
# Nginx configuration for stubbing _bulk requests and proxying everything
# else to a local Elasticsearch instance.
#
# This can be used to test performance of network and the load generator
# for pure bulk indexing benchmarks.
#
# This configuration has been tested with Rally (https://github.com/elastic/rally).
# nginx-extras for the more-include headers module
# sudo apt-get install nginx nginx-extras
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
listen 19200 default_server;
listen [::]:19200 default_server;
client_max_body_size 100M;
default_type application/json;
root /var/www/html;
index index.json index.html index.htm index.nginx-debian.html;
server_name _;
location / {
proxy_pass http://127.0.0.1:9200/;
}
location /_bulk {
if ($request_method = POST ) {
more_set_headers "Content-Type: application/json; charset=UTF-8";
return 200 '{"took":514,"errors":false,"items":[{"index":{"_index":"myindex","_type":"mytype","_id":"1","_version":1,"_shards":{"total":1,"successful":1,"failed":0},"created":true,"status":201}}]}';
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment