Skip to content

Instantly share code, notes, and snippets.

@martijnvg
Created January 28, 2013 16:35
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save martijnvg/4657029 to your computer and use it in GitHub Desktop.
Nested type and nested facets
curl -s -XPUT 'localhost:9200/test1' -d '{
"mappings" : {
"records" : {
"properties" : {
"coords" : {
"type" : "nested",
"properties" : {
}
}
}
}
}
}'
curl -s -XPOST 'http://localhost:9200/test1/records/' -d '{
"session_id" : "abc",
"user_id" : 1,
"timestamp" : 1359245610,
"coords" : [ {"v":"1x1"}, {"v":"1x1"}, {"v":"1x1"}, {"v":"4x4"}, {"v":"5x5"} ]
}'
curl -s -XPOST 'http://localhost:9200/test1/records/' -d '{
"session_id" : "abc",
"user_id" : 1,
"timestamp" : 1359245610,
"coords" : [ {"v":"2x2"}, {"v":"3x3"}, {"v":"1x1"}, {"v":"4x4"}, {"v":"5x5"} ]
}'
curl -s -XGET 'http://localhost:9200/test1/_search?pretty=true' -d '{
"query" : {
"matchAll" : {}
},
"facets" : {
"somename" : { "terms" : {"field" : "coords.v"}, "nested" : "coords" }
},
"size":0
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment