Skip to content

Instantly share code, notes, and snippets.

@drewr
Created December 4, 2013 03:11
Show Gist options
  • Save drewr/7781752 to your computer and use it in GitHub Desktop.
Save drewr/7781752 to your computer and use it in GitHub Desktop.
#!/bin/sh
curl -XDELETE localhost:9200/foo >/dev/null
curl -XPUT localhost:9200/foo/t/1\?routing=one -d'{"fizzle":[1,2]}'; echo
curl -XPUT localhost:9200/foo/t/2\?routing=two -d'{"fazzle":[3223,23]}'; echo
curl -XPOST localhost:9200/foo/_refresh; echo
curl localhost:9200/foo/_search -d'
{
"fields": [
"_routing",
"_source"
],
"query": {
"match_all": {}
}
}
'
## {"ok":true,"_index":"foo","_type":"t","_id":"1","_version":1}
## {"ok":true,"_index":"foo","_type":"t","_id":"2","_version":1}
## {"ok":true,"_shards":{"total":10,"successful":10,"failed":0}}
## {
## "_shards": {
## "failed": 0,
## "successful": 5,
## "total": 5
## },
## "hits": {
## "hits": [
## {
## "_id": "1",
## "_index": "foo",
## "_score": 1.0,
## "_source": {
## "fizzle": [
## 1,
## 2
## ]
## },
## "_type": "t",
## "fields": {
## "_routing": "one"
## }
## },
## {
## "_id": "2",
## "_index": "foo",
## "_score": 1.0,
## "_source": {
## "fazzle": [
## 3223,
## 23
## ]
## },
## "_type": "t",
## "fields": {
## "_routing": "two"
## }
## }
## ],
## "max_score": 1.0,
## "total": 2
## },
## "timed_out": false,
## "took": 2
## }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment