Skip to content

Add faceted search tutorial #10333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 29, 2025
Merged

Add faceted search tutorial #10333

merged 7 commits into from
Jul 29, 2025

Conversation

kolchfa-aws
Copy link
Collaborator

Closes #2157

Checklist

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Fanit Kolchina <[email protected]>
Signed-off-by: Fanit Kolchina <[email protected]>
Copy link

Thank you for submitting your PR. The PR states are In progress (or Draft) -> Tech review -> Doc review -> Editorial review -> Merged.

Before you submit your PR for doc review, make sure the content is technically accurate. If you need help finding a tech reviewer, tag a maintainer.

When you're ready for doc review, tag the assignee of this PR. The doc reviewer may push edits to the PR directly or leave comments and editorial suggestions for you to address (let us know in a comment if you have a preference). The doc reviewer will arrange for an editorial review.

@kolchfa-aws kolchfa-aws added Tech review PR: Tech review in progress backport 3.1 labels Jul 18, 2025
Signed-off-by: Fanit Kolchina <[email protected]>

A _facet_ is a filterable field that users can select to narrow their search results. In an e-commerce context, you might see facets like brand, color, size, and price range on the left side of search results. For example, a query like "winter jacket" may return many products. Facets let users filter products by a particular color or price range.

Faceted search displays value or range counts for each facet, helping users understand the distribution of results and quickly apply filters. This approach is especially useful in e-commerce and location-based search. You can implement facets using `terms` aggregations for exact values (like colors or sizes) and `range` aggregations for continuous values (like prices, dates, or distances).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe link to terms and range aggregation doc


The following sections provide examples of advanced faceted search functionality.

### Post-filter faceting
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this can be moved to section Filter by facet values.
Also I don't think we need to mention the keyword post-filter, but just describe the function or scenario.
Like the user selects a facet, the query results are filtered for that facet, but the facet selector is kept unchanged.

I think another thing worth mention is global aggregation https://docs.opensearch.org/latest/aggregations/bucket/global/. It always executed on the full dataset, seems a good way to have a unchanged facet selector.


</details>

### Exclude filtering
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also feels belong to Filter by facet values.
User can select or exclude.

{: .text-delta}

```json
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to show a image for the response. I try to ask AI to generate an ASCII diagram based on one response from here.

Image

You may not need to do this for every response. But just give one example case corresponding to one response.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I added pictures for some of the responses for easier visualization.

Signed-off-by: Fanit Kolchina <[email protected]>
@kolchfa-aws kolchfa-aws added Editorial review PR: Editorial review in progress and removed Tech review PR: Tech review in progress labels Jul 28, 2025
Copy link
Collaborator

@natebower natebower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kolchfa-aws Very nice job on this 😄. Please see my comments (lines 1164 and 1973) and changes and let me know if you have any questions (I'd like you to verify my textual changes as well). Thanks!

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: kolchfa-aws <[email protected]>
Copy link
Collaborator

@natebower natebower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@natebower natebower removed the Editorial review PR: Editorial review in progress label Jul 29, 2025
@natebower natebower merged commit e1dec2f into main Jul 29, 2025
7 checks passed
@natebower natebower deleted the faceted-search branch July 29, 2025 13:26
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 29, 2025
* First draft

Signed-off-by: Fanit Kolchina <[email protected]>

* Add more examples and extra credit

Signed-off-by: Fanit Kolchina <[email protected]>

* Add faceted search tutorial

Signed-off-by: Fanit Kolchina <[email protected]>

* Update _tutorials/faceted-search.md

Signed-off-by: kolchfa-aws <[email protected]>

* Remove multi-select faceting

Signed-off-by: Fanit Kolchina <[email protected]>

* Address tech review comments

Signed-off-by: Fanit Kolchina <[email protected]>

* Apply suggestions from code review

Co-authored-by: Nathan Bower <[email protected]>
Signed-off-by: kolchfa-aws <[email protected]>

---------

Signed-off-by: Fanit Kolchina <[email protected]>
Signed-off-by: kolchfa-aws <[email protected]>
Co-authored-by: Nathan Bower <[email protected]>
(cherry picked from commit e1dec2f)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Jul 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Faceted search [DOC]
3 participants