Skip to content

Instantly share code, notes, and snippets.

@renier
Last active August 29, 2015 14:02
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 renier/dc4344bd47d3e768011f to your computer and use it in GitHub Desktop.
Save renier/dc4344bd47d3e768011f to your computer and use it in GitHub Desktop.
Document is not available right away in elasticsearch
#!/bin/sh -x
curl -w "\n" -X DELETE http://localhost:9200/testing;
curl -w "\n" -X POST http://localhost:9200/testing/group -d '{"name":"default","description":"This is the default group.","id":null}';
# This next request returns 0 hits
curl -w "\n" -X GET http://localhost:9200/testing/group/_search;
sleep 1;
# After waiting one second, this request returns the previously created document
curl -w "\n" -X GET http://localhost:9200/testing/group/_search;
@renier
Copy link
Author

renier commented Jun 12, 2014

Answer: pass refresh=true on the post to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment