Last active
April 12, 2017 09:15
-
-
Save byronvoorbach/bc3d73c77aaa7ddaa96ee47a9ba886fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE test | |
#Create index | |
PUT test | |
{ | |
"mappings": { | |
"test": { | |
"properties": { | |
"colour": { | |
"type": "keyword" | |
} | |
} | |
} | |
} | |
} | |
#Add document 1 | |
POST test/test/1 | |
{ | |
"title": "this is a test", | |
"colour": "blue" | |
} | |
#Add document 2 | |
POST test/test/2 | |
{ | |
"title": "this is another test", | |
"colour": "blue" | |
} | |
#Query with collapse on colour field, source filtering both on top level document and on inner hits of collapse | |
#Throws an exception on the inner hits source filtering | |
#"reason": "[inner_hits] _source doesn't support values of type: START_ARRAY" | |
GET test/_search | |
{ | |
"_source": "title", | |
"query": { | |
"match_all": {} | |
}, | |
"collapse": { | |
"field": "colour", | |
"inner_hits": { | |
"name": "collapse", | |
"_source": [ | |
"title" | |
] | |
} | |
} | |
} | |
#Query with collapse on colour field, source filtering both on top level document and on inner hits of collapse | |
#Throws an exception on the inner hits source filtering | |
#"reason": "[inner_hits] _source doesn't support values of type: VALUE_STRING" | |
GET test/_search | |
{ | |
"_source": "title", | |
"query": { | |
"match_all": {} | |
}, | |
"collapse": { | |
"field": "colour", | |
"inner_hits": { | |
"name": "collapse", | |
"_source": "title" | |
} | |
} | |
} | |
#Query with collapse on colour field, source filtering both on top level document and on inner hits of collapse | |
#This works | |
GET test/_search | |
{ | |
"_source": "title", | |
"query": { | |
"match_all": {} | |
}, | |
"collapse": { | |
"field": "colour", | |
"inner_hits": { | |
"name": "collapse", | |
"_source": { | |
"includes": ["title"] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment