Prompt

How do I set up faceted search for products in my application?

Technology / Search & Discovery Tools1 observationLast seen Oct 12, 2026

Latest observation

Oct 12, 2026OpenAI APIWeb search: off

Faceted search lets users filter products by multiple attributes like brand, price, color, size, rating, etc. A good setup usually has 4 parts:

1) Define your searchable product data

Make sure each product has structured fields you can filter on.

Example:

{
  "id": 123,
  "name": "Running Shoe",
  "category": "Shoes",
  "brand": "Nike",
  "color": ["Black", "White"],
  "size": [9, 10, 11],
  "price": 89.99,
  "rating": 4.5,
  "inStock": true
}

2) Pick a search/filter backend

Common options:

  • Elasticsearch / OpenSearch: best for large catalogs and rich faceting
  • Algolia: very easy to implement, hosted solution
  • Database + custom filtering: fine for smaller apps
  • Meilisearch: simpler full-text + filtering search engine

If you need fast faceted search at scale, Elasticsearch/OpenSearch is a common choice.

3) Index fields properly

Facets work best when fields are indexed as filterable aggregations.

Typical rules:

  • Use keyword/exact fields for things like brand, category, color
  • Use numeric fields for price and ratings
  • Use boolean fields for availability
  • Use multi-valued fields for arrays like colors or sizes

Example in Elasticsearch-like terms:

  • brand.keyword
  • category.keyword
  • price
  • rating
  • inStock

4) Build the search query with filters + facet counts

Faceted search usually requires:

  • a search term
  • selected filters
  • facet counts for the remaining available options

Example user flow:

  • Search: "running"
  • Filters: brand = Nike, color = Black
  • Show counts for other facets like sizes available in the filtered result set

Example query idea

You generally:

  1. Apply selected filters to narrow results
  2. Ask the search engine to compute facet counts on the filtered dataset

In Elasticsearch, this is often done with:

  • bool query for filters
  • aggregations for facets

5) Render filters in the UI

Common facet types:

  • Checkbox lists: brand, color, category
  • Range sliders: price
  • Star filters: rating
  • Toggle switches: in stock only

Good UI practices:

  • Show counts next to each facet option
  • Disable or hide unavailable options
  • Allow multiple selections where it makes sense
  • Keep applied filters visible and removable

6) Support URL-driven filters

Store selected filters in the query string so users can share/bookmark results.

Example:

/products?query=running&brand=Nike&color=Black&minPrice=50&maxPrice=150

7) Keep facets fast and relevant

For performance:

  • Precompute or index facet-friendly fields
  • Cache common queries
  • Limit the number of facet values returned
  • Use pagination for result lists, not facets
  • Consider “top N” facet values plus “show more”

8) Common implementation pattern

A typical backend response looks like this:

{
  "results": [
    { "id": 123, "name": "Running Shoe", "brand": "Nike", "price": 89.99 }
  ],
  "facets": {
    "brand": [
      { "value": "Nike", "count": 42 },
      { "value": "Adidas", "count": 31 }
    ],
    "color": [
      { "value": "Black", "count": 25 },
      { "value": "White", "count": 18 }
    ],
    "price": {
      "min": 20,
      "max": 200
    }
  }
}

9) Watch out for these common pitfalls

  • Facets based on unstructured text fields
  • Counting facets before applying selected filters incorrectly
  • Slow queries on large datasets
  • Too many facet values overwhelming the UI
  • Not normalizing values like “blue”, “Blue”, “BLUE”

If you want, I can also show:

  1. a database-only implementation,
  2. an Elasticsearch/OpenSearch example, or
  3. a React + API design for faceted search.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.