generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 617
Add documentation for SEISMIC #11127
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
kolchfa-aws
merged 10 commits into
opensearch-project:main
from
zirui-song-18:clean_seismic_docs
Oct 9, 2025
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7731786
Add complete documentation for SEISMIC. Co-authored by Liyun Xiu, Yuy…
zirui-song-18 848698b
Address Yuye's comments: Fix link; Add section link; Uppercase to low…
zirui-song-18 b743ae4
Address Yuye's comments; Update correct response
zirui-song-18 e0a98e6
Doc review
kolchfa-aws 4055bec
Apply suggestions from code review
natebower d2923f5
Rewrite neual API page
kolchfa-aws 1b095f5
one more rewording
kolchfa-aws b74f070
Fix links
kolchfa-aws e2298a3
Apply suggestions from code review
kolchfa-aws 3f13b7f
Apply suggestions from code review
kolchfa-aws File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
--- | ||
layout: default | ||
title: Sparse vector | ||
nav_order: 22 | ||
has_children: false | ||
parent: Supported field types | ||
--- | ||
|
||
# Sparse vector | ||
**Introduced 3.3** | ||
{: .label .label-purple } | ||
|
||
The `sparse_vector` field supports [neural sparse approximate nearest neighbor (ANN) search]({{site.url}}{{site.baseurl}}/vector-search/ai-search/neural-sparse-ann/), which improves search efficiency while preserving relevance. A `sparse_vector` is stored as a map, in which each key represents the token and each value is a positive [`float`]({{site.url}}{{site.baseurl}}/opensearch/supported-field-types/numeric/) value indicating the token's weight. | ||
|
||
## Parameters | ||
|
||
The `sparse_vector` field type supports the following parameters. | ||
|
||
| Parameter | Type | Required | Description | Default | Range | | ||
|-------------------------|---------|----------|-----------------------------------------------|-----------------------|-------------| | ||
| `name` | String | Yes | The neural sparse ANN search algorithm. Valid value is `seismic`. | - | - | | ||
| `n_postings` | Integer | No | The maximum number of documents to retain in each posting list. | `0.0005 * doc_count`¹ | (0, ∞) | | ||
| `cluster_ratio` | Float | No | The fraction of documents in each posting list used to determine the cluster count. | `0.1` | (0, 1) | | ||
| `summary_prune_ratio` | Float | No | The fraction of tokens to keep in cluster summary vectors for approximate matching. | `0.4` | (0, 1] | | ||
kolchfa-aws marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `approximate_threshold` | Integer | No | The minimum number of documents in a segment required to activate neural sparse ANN search. | `1000000` | [0, ∞) | | ||
| `quantization_ceiling_search` | Float | No | The maximum token weight used for quantization during search. | `16` | (0, ∞) | | ||
| `quantization_ceiling_ingest` | Float | No | The maximum token weight used for quantization during ingestion. | `3` | (0, ∞) | | ||
|
||
|
||
¹`doc_count` represents the number of documents within the segment. | ||
|
||
For parameter configuration, see [Neural sparse ANN search]({{site.url}}{{site.baseurl}}/vector-search/ai-search/neural-sparse-ann). | ||
Check failure on line 32 in _field-types/supported-field-types/sparse-vector.md
|
||
{: .note } | ||
|
||
To increase search efficiency and reduce memory consumption, the `sparse_vector` field automatically performs quantization of the token weight. You can adjust the `quantization_ceiling_search` and `quantization_ceiling_ingest` parameters according to different token weight distributions. For doc-only queries, we recommend the default value (`16`). For bi-encoder queries, we recommend setting `quantization_ceiling_search` to `3`. For more information about doc-only and bi-encoder query modes, see [Generating sparse vector embeddings automatically]({{site.url}}{{site.baseurl}}/vector-search/ai-search/neural-sparse-with-pipelines/). | ||
|
||
{: .note} | ||
|
||
## Example | ||
|
||
The following example demonstrates using a `sparse_vector` field type. | ||
|
||
### Step 1: Create an index | ||
|
||
Create a sparse index by setting `index.sparse` to `true` and define a `sparse_vector` field in the index mapping: | ||
|
||
```json | ||
PUT sparse-vector-index | ||
{ | ||
"settings": { | ||
"index": { | ||
"sparse": true | ||
}, | ||
"mappings": { | ||
"properties": { | ||
"sparse_embedding": { | ||
"type": "sparse_vector", | ||
"method": { | ||
"name": "seismic", | ||
"parameters": { | ||
"n_postings": 300, | ||
"cluster_ratio": 0.1, | ||
"summary_prune_ratio": 0.4, | ||
"approximate_threshold": 1000000 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
|
||
### Step 2: Ingest data into the index | ||
|
||
Ingest three documents containing `sparse_vector` fields into your index: | ||
|
||
```json | ||
PUT sparse-vector-index/_doc/1 | ||
{ | ||
"sparse_embedding" : { | ||
"1000": 0.1 | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
```json | ||
PUT sparse-vector-index/_doc/2 | ||
{ | ||
"sparse_embedding" : { | ||
"2000": 0.2 | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
```json | ||
PUT sparse-vector-index/_doc/3 | ||
{ | ||
"sparse_embedding" : { | ||
"3000": 0.3 | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
### Step 3: Search the index | ||
|
||
You can query the sparse index by providing either raw vectors or natural language using a [`neural_sparse` query]({{site.url}}{{site.baseurl}}/query-dsl/specialized/neural-sparse/). | ||
|
||
#### Query using a raw vector | ||
|
||
To query using a raw vector, provide the `query_tokens` parameter: | ||
|
||
```json | ||
GET sparse-vector-index/_search | ||
{ | ||
"query": { | ||
"neural_sparse": { | ||
"sparse_embedding": { | ||
"query_tokens": { | ||
"1055": 5.5 | ||
}, | ||
"method_parameters": { | ||
"heap_factor": 1.0, | ||
"top_n": 10, | ||
"k": 10 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
#### Query using natural language | ||
|
||
To query using natural language, provide the `query_text` and `model_id` parameters: | ||
|
||
```json | ||
GET sparse-vector-index/_search | ||
{ | ||
"query": { | ||
"neural_sparse": { | ||
"sparse_embedding": { | ||
"query_text": "<input text>", | ||
"model_id": "<model ID>", | ||
"method_parameters": { | ||
"k": 10, | ||
"top_n": 10, | ||
"heap_factor": 1.0 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Related pages | ||
|
||
- [Neural sparse ANN search]({{site.url}}{{site.baseurl}}/vector-search/ai-search/neural-sparse-ann/) | ||
- [Neural sparse query]({{site.url}}{{site.baseurl}}/query-dsl/specialized/neural-sparse/) | ||
- [Neural sparse ANN search performance tuning]({{site.url}}{{site.baseurl}}/vector-search/performance-tuning-sparse/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
layout: default | ||
title: Star-tree | ||
nav_order: 61 | ||
nav_order: 62 | ||
parent: Supported field types | ||
--- | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not 100% token fraction. It actually describes the "mass" of the tokens to preserve in the cluster summary. I can provide an example:
Suppose the cluster summary, before pruning, is
{"100": 1, "200": 2, "300": 3, "400": 6}
. Then, givensummary_prune_ratio = 0.5
. There is going to be a single token left, which resulting in pruned summary{"400": 6}