def test_array_facet_returns_exact_value(self):
        """Test that searching an existing array field returns exact expected value"""
        # Forcefully remove documents from index post setup
        self.client.index(self.unstructured_text_index_name).delete_documents(
            [doc["_id"] for doc in EXAMPLE_FASHION_DOCUMENTS]
        )
        # Add documents with color, brand, style as tags
        docs_to_add = [{
            "_id": existing_doc["_id"],
            "title": existing_doc["title"],
            "description": existing_doc["description"],
            "size": existing_doc["size"],
            "price": existing_doc["price"],
            "color": existing_doc["color"],
            "brand": existing_doc["brand"],
            "style": existing_doc["style"],
            "tags": [f'color:{existing_doc["color"]}', f'brand:{existing_doc["brand"]}', f'style:{existing_doc["style"]}']
        } for existing_doc in EXAMPLE_FASHION_DOCUMENTS]
        self.client.index(self.unstructured_text_index_name).add_documents(
            docs_to_add,
            tensor_fields=["title", "description"]
        )

        res = self.client.index(self.unstructured_text_index_name).search(
            "shirt",
            search_method="HYBRID",
            facets={
                "fields": {
                    "tags": {
                        "type": "array",
                    },
                    "color": {
                        "type": "string"
                    },
                    "price": {
                        "type": "number"
                    }
                },
                # Those parameters do not affect results, but validating that api accepts them
                "maxResults": 100,
                "maxDepth": 600,
                "order": "desc"
            }
        )
        self.assertIn("facets", res)
        self.assertIn("tags", res["facets"])
        self.assertEqual(len(res["facets"]), 3)
        self.assert_dict_almost_equal(
            res["facets"],
            {
                "tags": {
                    "brand:SnugNest": {"count": 4},
                    "style:streetwear": {"count": 4},
                    "brand:PulseWear": {"count": 3},
                    "color:green": {"count": 3},
                    "color:red": {"count": 2},
                    "style:partywear": {"count": 2},
                    "color:charcoal": {"count": 2},
                    "style:loungewear": {"count": 2},
                    "brand:CozyCore": {"count": 1},
                    "brand:RetroHue": {"count": 1},
                    "brand:SprintX": {"count": 1},
                    "color:coral": {"count": 1},
                    "color:gray": {"count": 1},
                    "color:yellow": {"count": 1},
                    "style:biker": {"count": 1},
                    "style:casual": {"count": 1}
                },
                "color": {
                    'red': {'count': 2},
                    'green': {'count': 3},
                    'charcoal': {'count': 2},
                    'yellow': {'count': 1},
                    'coral': {'count': 1},
                    'gray': {'count': 1}
                }
,
                "price":
                {
                    'min': 1.2,
                    'max': 92.99,
                    'avg': 60.354,
                    'count': 10,
                    'sum': 603.54
                }
            },
            places=2
        )
Test that searching an existing array field returns exact expected value
tests/api_tests/v1/tests/api_tests/unstructured_index/test_facets.py