Skip to content

Instantly share code, notes, and snippets.

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 clintongormley/1630868 to your computer and use it in GitHub Desktop.
Save clintongormley/1630868 to your computer and use it in GitHub Desktop.
# [Wed Jan 18 05:03:23 2012] Protocol: http, Server: 192.168.5.10:9200
curl -XPOST 'http://127.0.0.1:9200/test/foo?pretty=1' -d '
{
"title" : "Main title",
"json" : "{\"count\":10,\"date\":\"2012-01-18\",\"title\":\"Test me\"}"
}
'
# [Wed Jan 18 05:03:23 2012] Response:
# {
# "ok" : true,
# "_index" : "test",
# "_id" : "cqIxGQ-7SYuw3FMvRbxkeQ",
# "_type" : "foo",
# "_version" : 1
# }
# [Wed Jan 18 05:03:44 2012] Protocol: http, Server: 192.168.5.10:9200
curl -XGET 'http://127.0.0.1:9200/test/_search?pretty=1' -d '
{
"query" : {
"text" : {
"json" : "test"
}
}
}
'
# [Wed Jan 18 05:03:44 2012] Response:
# {
# "hits" : {
# "hits" : [
# {
# "_source" : {
# "title" : "Main title",
# "json" : "{\"count\":10,\"date\":\"2012-01-18\",\"title\":\"Test me\"}"
# },
# "_score" : 0.095891505,
# "_index" : "test",
# "_id" : "cqIxGQ-7SYuw3FMvRbxkeQ",
# "_type" : "foo"
# }
# ],
# "max_score" : 0.095891505,
# "total" : 1
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "took" : 54
# }
# [Wed Jan 18 05:06:50 2012] Protocol: http, Server: 192.168.5.10:9200
curl -XGET 'http://127.0.0.1:9200/test/_search?pretty=1' -d '
{
"facets" : {
"json" : {
"terms" : {
"field" : "json"
}
}
},
"size" : 0
}
'
# [Wed Jan 18 05:06:50 2012] Response:
# {
# "hits" : {
# "hits" : [],
# "max_score" : 1,
# "total" : 1
# },
# "timed_out" : false,
# "_shards" : {
# "failed" : 0,
# "successful" : 5,
# "total" : 5
# },
# "facets" : {
# "json" : {
# "other" : 0,
# "terms" : [
# {
# "count" : 1,
# "term" : "title"
# },
# {
# "count" : 1,
# "term" : "test"
# },
# {
# "count" : 1,
# "term" : "me"
# },
# {
# "count" : 1,
# "term" : "date"
# },
# {
# "count" : 1,
# "term" : "count"
# },
# {
# "count" : 1,
# "term" : "2012"
# },
# {
# "count" : 1,
# "term" : "18"
# },
# {
# "count" : 1,
# "term" : "10"
# },
# {
# "count" : 1,
# "term" : "01"
# }
# ],
# "missing" : 0,
# "_type" : "terms",
# "total" : 9
# }
# },
# "took" : 2
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment