Skip to content

Instantly share code, notes, and snippets.

@imotov
Created June 27, 2011 13:43
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 imotov/1048874 to your computer and use it in GitHub Desktop.
Save imotov/1048874 to your computer and use it in GitHub Desktop.
# Clean the test index first
curl -XDELETE 'http://localhost:9200/sotest'
# Put Test Record
curl -XPUT 'http://localhost:9200/sotest/type1/1' -d '{
"content":"Some content with @someone mention",
"mentions":["someone"],
"userId":"4dff31eaf8815f4df04e2d62"
}'
# Returns --> {"ok":true,"_index":"sotest","_type":"type1","_id":"1","_version":1}
# Search
curl -XGET 'http://localhost:9200/sotest/_search' -d '{
"query": {
"filtered": {
"filter": { "term":{"userId":"4dff31eaf8815f4df04e2d62"} },
"query": {
"term": {"mentions":"someone"}
}
}
}
}'
# Returns --> {"took":377,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.30685282,"hits":[{"_index":"sotest","_type":"type1","_id":"1","_score":0.30685282, "_source" : {
"content":"Some content with @someone mention",
"mentions":["someone"],
"userId":"4dff31eaf8815f4df04e2d62"
}}]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment