Terms facet : bad results or misunderstanding?


(David Pilato) #1

Hi,

While I was creating a test case for this thread : http://elasticsearch-users.115913.n3.nabble.com/Terms-facet-getting-all-the-results-tp3051086p3055360.html, I saw something that looks wrong (or I didn't understood how terms facet works).

Here is a Gist : https://gist.github.com/1024756

My facet should return something like :
"facets" : {
"f_tags" : {
"_type" : "terms",
"missing" : 0,
"terms" : [ {
"term" : "seven",
"count" : 7
}, {
"term" : "six",
"count" : 6
}, {
"term" : "five",
"count" : 5
}, {
"term" : "four",
"count" : 4
}, {
"term" : "three",
"count" : 3
} ]
}

But, I got this :
"facets" : {
"f_tags" : {
"_type" : "terms",
"missing" : 0,
"terms" : [ {
"term" : "seven",
"count" : 7
}, {
"term" : "six",
"count" : 6
}, {
"term" : "three",
"count" : 3
}, {
"term" : "four",
"count" : 3
}, {
"term" : "five",
"count" : 3
} ]
}

As you can see, the 3 last terms seems to be wrong...

Am I doing something wrong ?

Thanks for any help
David.


(Shay Banon) #2

I am getting the correct counts with the gist you provided. Are you executing it as a single script? Maybe the last bits are not refreshed yet? Or maybe are you specifying in your test a different size for the facets?

On Tuesday, June 14, 2011 at 3:02 PM, David Pilato wrote:

Hi,

While I was creating a test case for this thread : http://elasticsearch-users.115913.n3.nabble.com/Terms-facet-getting-all-the-results-tp3051086p3055360.html, I saw something that looks wrong (or I didn't understood how terms facet works).

Here is a Gist : https://gist.github.com/1024756

My facet should return something like :
"facets" : {
"f_tags" : {
"_type" : "terms",
"missing" : 0,
"terms" : [ {
"term" : "seven",
"count" : 7
}, {
"term" : "six",
"count" : 6
}, {
"term" : "five",
"count" : 5
}, {
"term" : "four",
"count" : 4
}, {
"term" : "three",
"count" : 3
} ]
}

But, I got this :
"facets" : {
"f_tags" : {
"_type" : "terms",
"missing" : 0,
"terms" : [ {
"term" : "seven",
"count" : 7
}, {
"term" : "six",
"count" : 6
}, {
"term" : "three",
"count" : 3
}, {
"term" : "four",
"count" : 3
}, {
"term" : "five",
"count" : 3
} ]
}

As you can see, the 3 last terms seems to be wrong...

Am I doing something wrong ?

Thanks for any help
David.


(Shay Banon) #3

Sorry, I now see in the response that it did "see" 7 docs, so, its strange. Is the gist exactly what you are executing?

On Tuesday, June 14, 2011 at 6:53 PM, Shay Banon wrote:

I am getting the correct counts with the gist you provided. Are you executing it as a single script? Maybe the last bits are not refreshed yet? Or maybe are you specifying in your test a different size for the facets?

On Tuesday, June 14, 2011 at 3:02 PM, David Pilato wrote:

Hi,

While I was creating a test case for this thread : http://elasticsearch-users.115913.n3.nabble.com/Terms-facet-getting-all-the-results-tp3051086p3055360.html, I saw something that looks wrong (or I didn't understood how terms facet works).

Here is a Gist : https://gist.github.com/1024756

My facet should return something like :
"facets" : {
"f_tags" : {
"_type" : "terms",
"missing" : 0,
"terms" : [ {
"term" : "seven",
"count" : 7
}, {
"term" : "six",
"count" : 6
}, {
"term" : "five",
"count" : 5
}, {
"term" : "four",
"count" : 4
}, {
"term" : "three",
"count" : 3
} ]
}

But, I got this :
"facets" : {
"f_tags" : {
"_type" : "terms",
"missing" : 0,
"terms" : [ {
"term" : "seven",
"count" : 7
}, {
"term" : "six",
"count" : 6
}, {
"term" : "three",
"count" : 3
}, {
"term" : "four",
"count" : 3
}, {
"term" : "five",
"count" : 3
} ]
}

As you can see, the 3 last terms seems to be wrong...

Am I doing something wrong ?

Thanks for any help
David.


(Clinton Gormley) #4

On Tue, 2011-06-14 at 18:55 +0300, Shay Banon wrote:

Sorry, I now see in the response that it did "see" 7 docs, so, its
strange. Is the gist exactly what you are executing?

I tried the same gist on 0.16.2 and got the correct counts, but then
also had missing: 7

clint


(dpilato) #5

My bad !

I don't know why but after deleting the index curl -X DELETE "http://localhost:9200/articles"
and then creating articles, everything is now correct.

Sorry to have raised a fake bug !

Thanks for having take time looking at it.
Cheers


(system) #6