def test_number_facet_with_ranges(self):
        """Test getting numeric facet with custom ranges"""
        res = self.client.index(self.unstructured_text_index_name).search(
            "shirt",
            search_method="HYBRID",
            facets={
                "fields": {
                    "price": {
                        "type": "number",
                        "ranges": [
                            {"from": 0, "to": 50, "name": "cheap"},
                            {"from": 50, "name": "expensive"}
                        ]
                    }
                }
            }
        )
        self.assertIn("facets", res)
        self.assertIn("price", res["facets"])
        self.assertEqual(len(res["facets"]["price"]), 2)
Test getting numeric facet with custom ranges
tests/api_tests/v1/tests/api_tests/unstructured_index/test_facets.py