Skip to content

Instantly share code, notes, and snippets.

@erickt
Created December 16, 2011 20:17
Show Gist options
  • Select an option

  • Save erickt/1487774 to your computer and use it in GitHub Desktop.

Select an option

Save erickt/1487774 to your computer and use it in GitHub Desktop.
% curl -XDELETE http://localhost:9200/test/
{"ok":true,"acknowledged":true}
% curl -XPUT http://localhost:9200/test/
{"ok":true,"acknowledged":true}
% curl -XPUT http://localhost:9200/test/test/1?refresh=true -d {"foo":"1", "bar":"a"}
{"ok":true,"_index":"test","_type":"test","_id":"1","_version":1}
% curl -XPUT http://localhost:9200/test/test/1?refresh=true -d {"foo":"1", "bar":"bc"}
{"ok":true,"_index":"test","_type":"test","_id":"1","_version":2}
% curl -XGET http://localhost:9200/test/test/_mapping
{"test":{"properties":{"foo":{"type":"string"},"bar":{"type":"string"}}}}
% curl -XGET http://localhost:9200/test/test/_search?pretty=true -d {"query":{"match_all":{}}}
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "test",
"_type" : "test",
"_id" : "1",
"_score" : 1.0, "_source" : {"foo":"1", "bar":"bc"}
} ]
}
}
% curl -XGET http://localhost:9200/test/test/_search?pretty=true -d {"query":{"term":{"foo":"1"}}}
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "test",
"_type" : "test",
"_id" : "1",
"_score" : 0.30685282, "_source" : {"foo":"1", "bar":"bc"}
} ]
}
}
% curl -XGET http://localhost:9200/test/test/_search?pretty=true -d {"query":{"term":{"bar":"a"}}}
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
% curl -XGET http://localhost:9200/test/test/_search?pretty=true -d {"query":{"term":{"bar":"bc"}}}
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.30685282,
"hits" : [ {
"_index" : "test",
"_type" : "test",
"_id" : "1",
"_score" : 0.30685282, "_source" : {"foo":"1", "bar":"bc"}
} ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment