Skip to content

Commit 14f45ee

Browse files
authored
refactor!: Added retrieve online documents v2 method for elasticsearch (feast-dev#5295)
feat: Added retrieve online documents v2 method for elasticsearch Signed-off-by: ntkathole <[email protected]>
1 parent 7a61d6f commit 14f45ee

File tree

6 files changed

+352
-87
lines changed

6 files changed

+352
-87
lines changed

docs/reference/online-stores/elasticsearch.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ top_k = 5
6666

6767
# Retrieve the top k closest features to the query vector
6868

69-
feature_values = feature_store.retrieve_online_documents(
69+
feature_values = feature_store.retrieve_online_documents_v2(
7070
features=["my_feature"],
7171
query=query_vector,
72-
top_k=top_k
72+
top_k=top_k,
7373
)
7474
```
7575
{% endcode %}
@@ -79,17 +79,32 @@ Currently, the indexing mapping in the ElasticSearch online store is configured
7979

8080
{% code title="indexing_mapping" %}
8181
```json
82-
"properties": {
83-
"entity_key": {"type": "binary"},
84-
"feature_name": {"type": "keyword"},
85-
"feature_value": {"type": "binary"},
86-
"timestamp": {"type": "date"},
87-
"created_ts": {"type": "date"},
88-
"vector_value": {
89-
"type": "dense_vector",
90-
"dims": vector_field_length,
91-
"index": "true",
92-
"similarity": config.online_store.similarity,
82+
{
83+
"dynamic_templates": [
84+
{
85+
"feature_objects": {
86+
"match_mapping_type": "object",
87+
"match": "*",
88+
"mapping": {
89+
"type": "object",
90+
"properties": {
91+
"feature_value": {"type": "binary"},
92+
"value_text": {"type": "text"},
93+
"vector_value": {
94+
"type": "dense_vector",
95+
"dims": vector_field_length,
96+
"index": True,
97+
"similarity": config.online_store.similarity,
98+
},
99+
},
100+
},
101+
}
102+
}
103+
],
104+
"properties": {
105+
"entity_key": {"type": "keyword"},
106+
"timestamp": {"type": "date"},
107+
"created_ts": {"type": "date"},
93108
},
94109
}
95110
```

0 commit comments

Comments
 (0)