help! I can't figure out how to apply a must filter on a nested type.
I tried a filter/nested with query/bool/must which doesn't work. anybody
done this kind of thing before ?
mapping
{
"someobject" : {
"properties" : {
"organization" : {
"type" : "nested",
"properties" : {
"filtername" : { "type" : "string", "index" : "not_analyzed" },
"foldername" : { "type" : "string", "index" : "not_analyzed" },
"hidden" : { "type" : "boolean" }
}
},
"otherfields" : {
"type" : "string",
}
}
}
}
<<<<
my best guess is:
{
"filter": {
"nested": {
"path": "organization",
"query": {
"bool": {
"must": [
{ "term": { "organization.hidden": { "value": "false" } } },
{ "term": { "organization.filtername": { "value": "myfilter" }
} },
{ "term": { "organization.foldername": { "value": "myfolder" }
} }
]
}
}
}
}
}
<<<<
--
Frank Hsueh | frank.hsueh@gmail.com
ha ha ... I woke up this morning and found
Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.
and it works!
On Fri, May 11, 2012 at 10:57 PM, Frank Hsueh frank.hsueh@gmail.com wrote:
help! I can't figure out how to apply a must filter on a nested type.
I tried a filter/nested with query/bool/must which doesn't work. anybody
done this kind of thing before ?
mapping
{
"someobject" : {
"properties" : {
"organization" : {
"type" : "nested",
"properties" : {
"filtername" : { "type" : "string", "index" : "not_analyzed" },
"foldername" : { "type" : "string", "index" : "not_analyzed" },
"hidden" : { "type" : "boolean" }
}
},
"otherfields" : {
"type" : "string",
}
}
}
}
<<<<
my best guess is:
{
"filter": {
"nested": {
"path": "organization",
"query": {
"bool": {
"must": [
{ "term": { "organization.hidden": { "value": "false" } } },
{ "term": { "organization.filtername": { "value": "myfilter" }
} },
{ "term": { "organization.foldername": { "value": "myfolder" }
} }
]
}
}
}
}
}
<<<<
--
Frank Hsueh | frank.hsueh@gmail.com
--
Frank Hsueh | frank.hsueh@gmail.com