Facet stats for integer field not containing minimum value

Hi,

I have an index with about 10K records. There’s a “new_price” field in every record. For about 50% of the records, this is set to -1. The remaining records contain real prices.

When executing the following query:

{
	"maxValuesPerFacet": 1000,
	"attributesToRetrieve":"new_price",
	"attributesToHighlight":[],
	"numericFilters": [
		"new_price != -1"
	],
	"facets":["new_price"]
}

and then inspecting the facet_stats for new_price, the min value is given as 102970. But there are about 1000 records with values that go down to the lowest value which is 84632. When looking through the hits, I can see that the first 1000 results are less the the stated minimum. (The index is sorted by new_price asc)

Why isn’t facet_stats representative of actual data?

Hi @apl,

Can you inspect the response of the Algolia API and check for the value of exhaustiveFacetsCount ?
Counting facets is a very expensive operation, if the value is false then you won’t have the correct facets_stats.

@nicolas.baissas explains well why this might happen and how to optimize your index or the query in this topic Handling "exhaustiveFacetsCount": false

Cheers, Maxime

Hi Maxime,

I’m seeing “exhaustiveFacetsCount”:true

With repeated requests about a second apart, I’m getting a ~75ms response time. A “cold” request varies between 100 - 200ms. So it can’t be because it’s too slow…

Any other ideas?

//Plank.

hi @apl,

I can’t reproduce your error. Would you mind sending a mail at support@algolia.com linking to this issue so we can have a look?

Best,