Skip to content

Instantly share code, notes, and snippets.

@kimchy
Created July 27, 2011 04:36
Show Gist options
  • Save kimchy/1108683 to your computer and use it in GitHub Desktop.
Save kimchy/1108683 to your computer and use it in GitHub Desktop.
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/tweet/_mapping -d '
{
"tweet" : {
"properties" : {
"name" : {
"type" : "string"
},
"comments" : {
"properties" : {
"text" : {
"type" : "string"
},
"username" : {
"type" : "string"
}
},
"type" : "nested"
}
}
}
}
'
curl -XPUT localhost:9200/test/tweet/1 -d '{
"name" : "Jane",
"comments" : [
{"text" : "this is text", "username" : "Jane"},
{"text" : "this is more text", "username" : "Jack"}
]
}'
curl localhost:9200/test/_search -d '
{
"query": {
"nested": {
"path": "comments",
"query": {
"bool": {
"must": [
{
"text": {
"comments.text": "this"
}
}
]
}
}
}
}
}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment