You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vector stores are currently supported in the Python API only. Java API support is planned for future releases.
29
-
{{< /hint >}}
30
-
31
27
{{< hint info >}}
32
28
This page covers semantic search using vector stores. Additional query modes (keyword, hybrid) are planned for future releases.
33
29
{{< /hint >}}
@@ -50,43 +46,99 @@ To use vector stores in your agents, you need to configure both a vector store a
50
46
51
47
Flink Agents provides decorators to simplify vector store setup within agents:
52
48
49
+
{{< tabs "Resource Decorators" >}}
50
+
51
+
{{< tab "Python" >}}
52
+
53
53
#### @vector_store
54
54
55
55
The `@vector_store` decorator marks a method that creates a vector store. Vector stores automatically integrate with embedding models for text-based search.
56
56
57
+
{{< /tab >}}
58
+
59
+
{{< tab "Java" >}}
60
+
61
+
#### @VectorStore
62
+
63
+
The `@VectorStore` annotation marks a method that creates a vector store.
64
+
65
+
{{< /tab >}}
66
+
67
+
{{< /tabs >}}
68
+
57
69
### Query Objects
58
70
59
71
Vector stores use structured query objects for consistent interfaces:
60
72
73
+
{{< tabs "Query Objects" >}}
74
+
75
+
{{< tab "Python" >}}
76
+
61
77
```python
62
78
# Create a semantic search query
63
79
query = VectorStoreQuery(
64
-
mode=VectorStoreQueryMode.SEMANTIC,
65
80
query_text="What is Apache Flink Agents?",
66
81
limit=3
67
82
)
68
83
```
69
84
70
-
### Query Results
85
+
{{< /tab >}}
71
86
72
-
When you execute a query, you receive a `VectorStoreQueryResult` object that contains the search results:
87
+
{{< tab "Java" >}}
73
88
74
-
```python
75
-
# Execute the query
76
-
result = vector_store.query(query)
89
+
```java
90
+
// Create a semantic search query
91
+
VectorStoreQuery query =newVectorStoreQuery(
92
+
"What is Apache Flink Agents?", // query text
93
+
3// limit
94
+
);
77
95
```
78
96
97
+
{{< /tab >}}
98
+
99
+
{{< /tabs >}}
100
+
101
+
### Query Results
102
+
103
+
When you execute a query, you receive a `VectorStoreQueryResult` object that contains the search results:
104
+
79
105
The `VectorStoreQueryResult` contains:
80
106
-**documents**: A list of `Document` objects representing the retrieved results
81
107
- Each `Document` has:
82
108
-**content**: The actual text content of the document
[Chroma](https://www.trychroma.com/home) is an open-source vector database that provides efficient storage and querying of embeddings with support for multiple deployment modes.
147
255
256
+
{{< hint info >}}
257
+
Chroma is currently supported in the Python API only.
[Elasticsearch](https://www.elastic.co/elasticsearch/) is a distributed, RESTful search and analytics engine that supports vector search through dense vector fields and K-Nearest Neighbors (KNN).
391
+
392
+
{{< hint info >}}
393
+
Elasticsearch is currently supported in the Java API only.
394
+
{{< /hint >}}
395
+
396
+
#### Prerequisites
397
+
398
+
1. An Elasticsearch cluster (version 8.0 or later for KNN support).
399
+
2. An index with a `dense_vector` field.
400
+
401
+
#### ElasticsearchVectorStore Parameters
402
+
403
+
| Parameter | Type | Default | Description |
404
+
|-----------|------|---------|-------------|
405
+
|`embedding_model`| str | Required | Reference to embedding model resource name |
406
+
|`index`| str | Required | Target Elasticsearch index name |
407
+
|`vector_field`| str | Required | Name of the dense vector field used for KNN |
408
+
|`dims`| int |`768`| Vector dimensionality |
409
+
|`k`| int | None | Number of nearest neighbors to return; can be overridden per query |
410
+
|`num_candidates`| int | None | Candidate set size for ANN search; can be overridden per query |
411
+
|`filter_query`| str | None | Raw JSON Elasticsearch filter query (DSL) applied as a post-filter |
@@ -277,6 +457,10 @@ If you want to use vector stores not offered by the built-in providers, you can
277
457
278
458
The base class handles text-to-vector conversion and provides the high-level query interface. You only need to implement the core vector search functionality.
279
459
460
+
{{< tabs "Custom Vector Store" >}}
461
+
462
+
{{< tab "Python" >}}
463
+
280
464
```python
281
465
classMyVectorStore(BaseVectorStore):
282
466
# Add your custom configuration fields here
@@ -294,4 +478,42 @@ class MyVectorStore(BaseVectorStore):
294
478
# - kwargs: Vector store-specific parameters
295
479
# - Returns: List of Document objects matching the search criteria
0 commit comments