Skip to content

Conversation

kosabogi
Copy link
Contributor

@kosabogi kosabogi commented Oct 7, 2025

This PR adds a new section to the semantic_text field type documentation with quick links to examples for querying semantic_text fields using different query types (match, kNN, sparse_vector, and semantic).

The links to the specific query type examples will be added by @charlotte-hoblik in her PR, as she’s currently working on creating those example pages.

Related issue: https://github.com/elastic/developer-docs-team/issues/321

@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.3.0 labels Oct 7, 2025
Copy link
Contributor

github-actions bot commented Oct 7, 2025

Copy link
Contributor

github-actions bot commented Oct 7, 2025

ℹ️ Important: Docs version tagging

👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version.

We use applies_to tags to mark version-specific features and changes.

Expand for a quick overview

When to use applies_to tags:

✅ At the page level to indicate which products/deployments the content applies to (mandatory)
✅ When features change state (e.g. preview, ga) in a specific version
✅ When availability differs across deployments and environments

What NOT to do:

❌ Don't remove or replace information that applies to an older version
❌ Don't add new information that applies to a specific version without an applies_to tag
❌ Don't forget that applies_to tags can be used at the page, section, and inline level

🤔 Need help?

@kosabogi kosabogi added the Team:Docs Meta label for docs team label Oct 7, 2025
@elasticsearchmachine elasticsearchmachine removed the Team:Docs Meta label for docs team label Oct 7, 2025
@kosabogi kosabogi requested a review from a team October 7, 2025 10:51
@kosabogi kosabogi added the Team:Docs Meta label for docs team label Oct 7, 2025
@elasticsearchmachine elasticsearchmachine removed the Team:Docs Meta label for docs team label Oct 7, 2025
@kosabogi kosabogi added Team:Docs Meta label for docs team and removed needs:triage Requires assignment of a team area label labels Oct 7, 2025
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label and removed Team:Docs Meta label for docs team labels Oct 7, 2025
@leemthompo leemthompo added Team:Docs Meta label for docs team auto-backport Automatically create backport pull requests when merged v9.2.0 >docs General docs changes labels Oct 7, 2025
@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Oct 7, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/core-docs (Team:Docs)

Copy link
Contributor

@leemthompo leemthompo left a comment

Choose a reason for hiding this comment

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

Left couple options for how we might proceed here, as the original assumed scope of a standalone page has shrunk quite a bit.


- [Sparse vector query](/reference/query-languages/query-dsl/query-dsl-sparse-vector-query.md) - Executes searches using sparse vectors generated by a sparse retrieval model. Refer to examples of sparse vector queries on `semantic_text` fields.

- [Semantic query](/reference/query-languages/query-dsl/query-dsl-semantic-query.md) - A legacy option that was introduced earlier and is no longer recommended, but it remains supported for existing implementations. Refer to examples of semantic queries on `semantic_text` fields.
Copy link
Member

Choose a reason for hiding this comment

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

As the semantic query is GA and still supported, do we really want to use this language?

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to use this exact verbiage, but if we have strong opinions and we don't think folks should use semantic queries in new implementations, then we should be quite clear about that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe @serenachou raised the original issue in slack, (which I had misremembered as coming from you Kathleen 😄) :

semantic_text now supports multiple query types (match, knn, sparse_vector) that provide more flexibility and customization options. This leads to confusion and has led to feature requests for functionality that already exists in other query types.

So there's nothing wrong with being clear in our recommendations, while still stating that semantic queries remain supported

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@leemthompo leemthompo left a comment

Choose a reason for hiding this comment

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

Few more little things, thanks for iterating :)

- [Sparse vector query](/reference/query-languages/query-dsl/query-dsl-sparse-vector-query.md) - Executes searches using sparse vectors generated by a sparse retrieval model. Refer to examples of sparse vector queries on `semantic_text` fields.

- [Semantic query](/reference/query-languages/query-dsl/query-dsl-semantic-query.md) - A legacy option that was introduced earlier and is no longer recommended, but it remains supported for existing implementations. Refer to examples of semantic queries on `semantic_text` fields.
- [Match query](/reference/query-languages/query-dsl/query-dsl-match-query.md) - The recommended method for querying `semantic_text` fields.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- [Match query](/reference/query-languages/query-dsl/query-dsl-match-query.md) - The recommended method for querying `semantic_text` fields.
- [Match query](/reference/query-languages/query-dsl/query-dsl-match-query.md): The recommended method for querying `semantic_text` fields.

You can perform match queries in query DSL or ESQL, so we should use tabs here (like we do in this doc) and mention https://www.elastic.co/docs/reference/query-languages/esql/functions-operators/search-functions#esql-match

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this should be included in the query examples section (the one we link to from here), right?
cc @charlotte-hoblik

Copy link
Contributor

Choose a reason for hiding this comment

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

right but if you're linking to query DSL here, then you should link to ESQL too for symmetry, but it doesn't necessarily have to be tabs if that's too heavy-handed

Copy link
Contributor

Choose a reason for hiding this comment

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

You could just do something like:

  • Match query: The recommended method for querying semantic_text fields. You can use Query DSL or ES|QL syntax.

Copy link
Contributor

@leemthompo leemthompo left a comment

Choose a reason for hiding this comment

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

Thanks @kosabogi!

As a last action on this PR, I had one other suggestion in there to add a note to the semantic query page that mirrors this verbiage:

We don't recommend this legacy query type for new projects, because the alternatives in this list enable more flexibility and customization. The semantic query remains available to support existing implementations.

Ignore if the plan was to add that in another PR :)

@kosabogi
Copy link
Contributor Author

kosabogi commented Oct 8, 2025

Thanks @kosabogi!

As a last action on this PR, I had one other suggestion in there to add a note to the semantic query page that mirrors this verbiage:

We don't recommend this legacy query type for new projects, because the alternatives in this list enable more flexibility and customization. The semantic query remains available to support existing implementations.

Ignore if the plan was to add that in another PR :)

@leemthompo I added the note in this PR, could you take a last look please? Thank you! :)

@leemthompo
Copy link
Contributor

🚢

@kosabogi kosabogi merged commit 9063ec6 into elastic:main Oct 8, 2025
11 checks passed
kosabogi added a commit to kosabogi/elasticsearch that referenced this pull request Oct 8, 2025
* Adds Querying semantic_text fields section

* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md

Co-authored-by: Liam Thompson <[email protected]>

* Comment out links temporarily

* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md

Co-authored-by: Liam Thompson <[email protected]>

* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md

Co-authored-by: Liam Thompson <[email protected]>

* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md

Co-authored-by: Liam Thompson <[email protected]>

* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md

Co-authored-by: Liam Thompson <[email protected]>

* Adds ESQL link to match query

* Fixes link

* Adds note to the Semantic query page

---------

Co-authored-by: Liam Thompson <[email protected]>
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
9.2

elasticsearchmachine pushed a commit that referenced this pull request Oct 8, 2025
* Adds Querying semantic_text fields section

* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md



* Comment out links temporarily

* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md



* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md



* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md



* Update docs/reference/elasticsearch/mapping-reference/semantic-text.md



* Adds ESQL link to match query

* Fixes link

* Adds note to the Semantic query page

---------

Co-authored-by: Liam Thompson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged >docs General docs changes documentation Team:Docs Meta label for docs team v9.2.0 v9.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants