Terms facet: does it work when field appears multiple times in the doc?


(pedro) #1

Hello there.

I'm having a terms facet returning different things than I expected.

My docs have this structure:

{
{a: { name: "a"}},
{b: { name: "b"}},
{c: { name: "c"}},
{d: { name: "d"}},
}

, where those a...d vary according to the doc.

When I do a terms facet on "field":"name", appears to me that ES is only
getting the first term on the doc, cause I get 3 terms while I was
expecting 166.

Any tips / comments on this? Whenever I have this kind of very dynamic
mapping I have troubles doing this kind of queries...

Cheers

-pedro


(Karussell) #2

are you faceting on a none analyzed field?

"The field used for facet calculations must be of type numeric, date/
time or analyzed as a single token."

E.g. if you like multiple values for one field you can use an array of
strings

Peter.

On 19 Okt., 13:03, Pedro Alves pmgal...@gmail.com wrote:

Hello there.

I'm having a terms facet returning different things than I expected.

My docs have this structure:

{
{a: { name: "a"}},
{b: { name: "b"}},
{c: { name: "c"}},
{d: { name: "d"}},

}

, where those a...d vary according to the doc.

When I do a terms facet on "field":"name", appears to me that ES is only
getting the first term on the doc, cause I get 3 terms while I was
expecting 166.

Any tips / comments on this? Whenever I have this kind of very dynamic
mapping I have troubles doing this kind of queries...

Cheers

-pedro


(system) #3