Skip to content

Instantly share code, notes, and snippets.

@pulkitsinghal
Last active December 16, 2015 14:09
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 pulkitsinghal/5447250 to your computer and use it in GitHub Desktop.
Save pulkitsinghal/5447250 to your computer and use it in GitHub Desktop.
Multivalue field and facet query - unexpected results...
properties: {
id: {
type: string
},
name: {
type: string
},
bought_together: {
dynamic: true,
properties: {
id: {
type: string
},
name: {
type: string
}
}
}
}
dummy_index_4: {
sale: {
properties: {
bought_together: {
type: nested
properties: {
id: {
type: string
}
name: {
type: string
}
}
}
id: {
type: string
}
name: {
type: string
}
}
}
}
{
id: 6,
name: Bread,
bought_together: [
{
id: 7,
name: Cheese
},
{
id: 8,
name: Eggs
},
{
id: 8,
name: Eggs
},
{
id: 7,
name: Cheese
}
]
}
{
"query": {
"text": {
"name": "BrEaD"
}
},
"facets": {
"tag": {
"terms": {
"field": "bought_together.name",
"size": 10
}
}
}
}
facets: {
tag: {
_type: terms,
missing: 0,
total: 2,
other: 0,
terms: [
{
term: eggs,
count: 1
},
{
term: cheese,
count: 1
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment