Skip to content

Instantly share code, notes, and snippets.

@markharwood
Last active December 23, 2016 16:56
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 markharwood/fec539e954dfffe162af8817b962ffa1 to your computer and use it in GitHub Desktop.
Save markharwood/fec539e954dfffe162af8817b962ffa1 to your computer and use it in GitHub Desktop.
Collapsing Inner hits "from:1" issue
// Test for PR 22337
// This only fails if number_of_shards ==1
DELETE test
PUT test
{
"settings":{
"number_of_shards": 1
},
"mappings": {
"article": {
"properties": {
"domain": {
"type": "keyword"
},
"tweets": {
"type": "integer"
},
"title": {
"type": "text"
}
}
}
}
}
POST test/article
{
"domain":"site1",
"tweets":10,
"title":"story 1"
}
POST test/article
{
"domain":"site1",
"tweets":20,
"title":"story 2"
}
POST test/article
{
"domain":"site1",
"tweets":30,
"title":"story 3"
}
POST test/article
{
"domain":"site2",
"tweets":20,
"title":"story 4"
}
// This use of "from" does not de-dup as expected - first inner same as root
GET test/article/_search?q=story
{
"collapse": {
"field": "domain",
"inner_hits": {
"name": "collapsed_hits",
"size": 3,
"from":1
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment