Skip to content

Instantly share code, notes, and snippets.

@roytmana
Created February 20, 2014 14:32
Show Gist options
  • Save roytmana/9114933 to your computer and use it in GitHub Desktop.
Save roytmana/9114933 to your computer and use it in GitHub Desktop.
missing aggregation fails
curl -XDELETE http://localhost:9200/test
curl -XPOST http://localhost:9200/test -d'{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"ht": {
"dynamic": "strict",
"properties": {
"name": {
"type": "string",
"index_options": "offsets"
},
"id": {
"type": "long",
"index_options": "offsets"
},
"date": {
"type": "date",
"format": "date",
"index_options": "offsets"
},
"kind": {
"properties": {
"name": {
"type": "string",
"index_options": "offsets"
},
"id": {
"type": "long",
"index_options": "offsets"
}
}
},
"type": {
"properties": {
"name": {
"type": "string",
"index_options": "offsets"
},
"id": {
"type": "long",
"index_options": "offsets"
},
"date": {
"type": "date",
"format": "date",
"index_options": "offsets"
}
}
}
}
}
}
}'
curl -XPOST "http://localhost:9200/test/ht" -d'{
"id":10,
"name":"photography",
"date":"2010-01-12",
"kind": {
"id": 10,
"name": "vendor"
},
"type": {
"id": 1000,
"name": "google"
}
}'
curl -XPOST "http://localhost:9200/test/ht" -d'{
"name":"photo equipment",
"date":"2010-01-12",
"kind": {
"id": 10,
"name": "vendor"
}
}'
curl -XPOST "http://localhost:9200/test/ht/_search" -d'
{
"query": {
"match_all": {}
},
"size": 0,
"aggs": {
"type_missing": {
"missing": {
"field": "type.id"
}
},
"type": {
"terms": {
"field": "type.id"
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment