Skip to content

Instantly share code, notes, and snippets.

Created November 22, 2013 16:11
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 anonymous/a58e2db23e2ee39dc89c to your computer and use it in GitHub Desktop.
Save anonymous/a58e2db23e2ee39dc89c to your computer and use it in GitHub Desktop.
Given the following articles ( I haven't loaded the comments yet so this structure will do for illustration ):
{
"article" : {
"title" : "article 1",
"comment" : [
{ "text":"mytext1", "date": "2013-11-21", "author": "matt" },
{ "text":"mytext2", "date": "2013-12-01", "author": "matt" }
]
}
}
{
"article" : {
"title" : "article 2",
"comment" : [
{ "text":"mytext3", "date": "2014-01-21", "author": "matt" },
{ "text":"mytext4", "date": "2014-02-01", "author": "matt" }
]
}
}
I can execute a query that returns:
{
"hits" : [
{
"_id" : 1,
"_source" : {
"title" : "article 1",
"comment" : { "text" : "mytext2", "date" : "2013-12-01" }
}
},
{
"_id" : 2,
"_source" : {
"title" : "article 2",
"comment" : { "text" : "mytext4", "date" : "2014-02-01" }
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment