Skip to content

Instantly share code, notes, and snippets.

@clintongormley
Forked from resetdel/gist:837120
Created February 21, 2011 14:51
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/837158 to your computer and use it in GitHub Desktop.
Save clintongormley/837158 to your computer and use it in GitHub Desktop.
curl -XPUT 'http://localhost:9200/testme/testme' -d '{
streamType: "Feed",
tenantId: "1",
message: "bla bla bla post bla bla 1 bla",
description: "Description",
postDate:"2010-06-03T21:11:09+0300"
}'
curl -XPOST 'http://localhost:9200/testme/testme/_search' -d '{ sort:{postDate:{reverse:true}}, size:100, query : { bool : {must : [ {wildcard : { message : "*post*" }}, {term : { tenantId : "1" }} ] }} ,"highlight" : { "pre_tags" : ["<em class='highlight'>"], "post_tags" : ["</em>"], "fields" : {"message" : {"fragment_size" : 200, "number_of_fragments" : 1}}}}'
Response:
{"took":7,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":null,"hits":[{"_index":"testme","_type":"testme","_id":"1gf-JGBaTHKIiIUzBRCKNw","_score":null, "_source" : {
streamType: "Feed",
tenantId: "1",
message: "bla bla bla post bla bla 1 bla",
description: "Description",
postDate:"2010-06-03T21:11:09+0300"
},"highlight":{"message":["bla bla bla <em class='highlight'>post</em> bla bla <em class='highlight'>1</em> bla"]},"sort":[1275588669000]}]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment