Hello,
I have an index setting that seems valid:
{
"mappings": {
"dynamic": false,
"fields": {
"variants": {
"fields": {
"priceVariants": {
"fields": {
"default": {
"fields": {
"price": [
{
"type": "number"
},
{
"type": "numberFacet"
}
]
},
"type": "document"
}
},
"type": "document"
}
},
"type": "document"
}
}
}
}
and document that match
"_id" : "63d32105fa861f7db4b57866-en-published",
"variants" : [
{
"sku" : "my-super-red-t-shirt-1674780931920",
"priceVariants" : {
"default" : {
"price" : NumberInt(123),
"currency" : "eur"
}
},
{
"sku" : "my-super-t-shirt-1674783282149",
"priceVariants" : {
"default" : {
"price" : NumberInt(123),
"currency" : "eur"
}
},
}
]
}`
The index is set and active, I double-checked the typo too.
Not all the documents have variants. I don’t know if that can have an impact.
When I try to query the facets, everything goes to “other” all the time
What do I do wrong?
{
"$search": {
"index": "mycollection",
"facet": {
"facets": {
"priceFacet": {
"type": "number",
"path": "variants.priceVariants.default.price",
"boundaries": [0, 50, 100, 150, 200],
"default": "other"
}
}
}
}
},
{
"$facet": {
"docs": [{ "$limit": 25 }],
"meta": [{ "$replaceWith": "$$SEARCH_META" }, { "$limit": 1 }],
}
},
{
"$addFields": {
"score": { "$meta": "searchScore" }
}
},
{
"$set": {
"meta": { "$arrayElemAt": ["$meta", 0] }
}
}
]`````````
`