Facet count for nested value "no" is missing

I have a nested field with possible values of "yes", "no", "maybe". It is
type "string", not analyzed. When I ask for facet counts for this field
(terms facet), I get back counts for "yes" and "maybe", and then the count
that I would expect for "no" is in the missing count, instead of in the
terms list. It is acting like "no" has some type of special handling or
behavior. I am unable to find any reference to a special behavior like
this in the docs. Is there some way to get the value "no" to behave
normally?

I tested that it works fine to have "no" in a non-nested field, so it seems
to be specific to nesting.

data (python code):

    [{
        'id' : 1,
        'recommendations' : [{
            'username' : 'user0',
            'recommendation' : 'yes',
        }]
    },
    {
        'id' : 10,
        'recommendations' : [{
            'username' : 'user0',
            'recommendation' : 'no',
        }]
    },
    {
        'id' : 7,
        'recommendations' : [{
            'username' : 'user0',
            'recommendation' : 'maybe',
        }]
    },]

query:

{
'query': {
'match_all': {}
},
'facets': {
'recommendations': {
'terms': {
'field': 'recommendations.recommendation',
'size': 10},
'nested': 'recommendations'
}
}
}

facets in the results:

'facets': {
'recommendations': {
'_type': 'terms',
'total': 2,
'terms': [{
'count': 1, u'term': u'yes'
}, {
'count': 1, u'term': u'maybe'
}],
'other': 0,
'missing': 1
}
}

Thanks for any help!

Nathan

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d7a703e3-3ee6-41fe-971b-8485c83a52d3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ok, I figured it out. It turns out that index: not_analyzed doesn’t get inherited from the parent, for nested properties. I thought that

‘recommendations’ : {
‘type’ : ‘nested’,
‘index’ : ‘not_analyzed’,
‘properties’ : {
‘recommendation’ : {
‘type’ : ‘string’
}
}
}

would make recommendations.recommendation be not_analyzed, but that wasn’t true. moving index: not_analyzed down to the recommendation property fixed the problem.

Nathan

On Dec 16, 2013, at 5:01 PM, Nathan nathannospam@gmail.com wrote:

I have a nested field with possible values of "yes", "no", "maybe". It is type "string", not analyzed. When I ask for facet counts for this field (terms facet), I get back counts for "yes" and "maybe", and then the count that I would expect for "no" is in the missing count, instead of in the terms list. It is acting like "no" has some type of special handling or behavior. I am unable to find any reference to a special behavior like this in the docs. Is there some way to get the value "no" to behave normally?

I tested that it works fine to have "no" in a non-nested field, so it seems to be specific to nesting.

data (python code):

    [{
        'id' : 1,
        'recommendations' : [{
            'username' : 'user0',
            'recommendation' : 'yes',
        }]
    },
    {
        'id' : 10,
        'recommendations' : [{
            'username' : 'user0',
            'recommendation' : 'no',
        }]
    },
    {
        'id' : 7,
        'recommendations' : [{
            'username' : 'user0',
            'recommendation' : 'maybe',
        }]
    },]

query:

{
'query': {
'match_all': {}
},
'facets': {
'recommendations': {
'terms': {
'field': 'recommendations.recommendation',
'size': 10},
'nested': 'recommendations'
}
}
}

facets in the results:

'facets': {
'recommendations': {
'_type': 'terms',
'total': 2,
'terms': [{
'count': 1, u'term': u'yes'
}, {
'count': 1, u'term': u'maybe'
}],
'other': 0,
'missing': 1
}
}

Thanks for any help!

Nathan

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/tOuUs9ruFn0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d7a703e3-3ee6-41fe-971b-8485c83a52d3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6E1A2557-15D6-41E0-9624-EA459E94FFEF%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.