Created
July 27, 2011 04:36
-
-
Save kimchy/1108683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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