Skip to content

Instantly share code, notes, and snippets.

@dazraf
Last active August 29, 2015 13:58
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 dazraf/9957039 to your computer and use it in GitHub Desktop.
Save dazraf/9957039 to your computer and use it in GitHub Desktop.
Why doesn't this mapping work?
curl -XPUT "http://localhost:9200/contests/" -d'
{
"settings": {
"index.number_of_replicas": 0,
"index.number_of_shards": 1,
"index.refresh_interval": -1
},
"mappings": {
"contest": {
"properties": {
"contestant": {
"type": "nested",
"properties": {
"id": {
"type": "string",
"index": "not_analyzed"
},
"data": {
"type": "nested",
"properties": {
"timing": {
"type": "integer"
},
"expectedTiming": {
"type": "integer"
}
}
}
}
}
}
}
}
}'
curl -XGET "http://localhost:9200/contests/_search" -d'
{
"aggs": {
"myResults": {
"nested": {
"path": "contestant"
},
"aggs": {
"per_contestant": {
"terms": {
"field": "id"
},
"aggs": {
"timingInfo": {
"nested": {
"path": "contestant.data"
},
"aggs": {
"sum": {
"field": "contestant.data.timing"
}
}
}
}
}
}
}
},
"explain": true
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment