Difference in nested facet filters


(Ivan Brusic) #1

Fine-tuning some queries and I had a question. There are two syntaxes
(syntaxii?) that produce equivalent results:

DIRECT TERM FILTER:
{
"facets": {
"nested1": {
"nested": "nested1",
"terms": {
"field": "nested1.field1"
},
"facet_filter": {
"term": {
"nested1.field2": 1
}
}
}
}
}

NESTED FILTER:
{
"facets": {
"nested1": {
"nested": "nested1",
"terms": {
"field": "nested1.field1"
},
"facet_filter": {
"nested": {
"path": "nested1",
"join": false,
"query": {
"term": {
"nested1.field2": 1
}
}
}
}
}
}
}

Obviously, the first one is far more concise. Not sure what are the caching
difference would be since the latter has explicit caching. My only guess
is the latter is used when combining filters based on fields in both the
nested document and the parent. Correct?

Cheers,

Ivan

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #2

When does the default join (true) make sense? I cannot come up with use
case where facets work with the default join.

--
Ivan

On Tue, Oct 8, 2013 at 5:50 PM, Ivan Brusic ivan@brusic.com wrote:

Fine-tuning some queries and I had a question. There are two syntaxes
(syntaxii?) that produce equivalent results:

DIRECT TERM FILTER:
{
"facets": {
"nested1": {
"nested": "nested1",
"terms": {
"field": "nested1.field1"
},
"facet_filter": {
"term": {
"nested1.field2": 1
}
}
}
}
}

NESTED FILTER:
{
"facets": {
"nested1": {
"nested": "nested1",
"terms": {
"field": "nested1.field1"
},
"facet_filter": {
"nested": {
"path": "nested1",
"join": false,
"query": {
"term": {
"nested1.field2": 1
}
}
}
}
}
}
}

Obviously, the first one is far more concise. Not sure what are the
caching difference would be since the latter has explicit caching. My only
guess is the latter is used when combining filters based on fields in both
the nested document and the parent. Correct?

Cheers,

Ivan

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #3