@@ -66,10 +66,10 @@ top_k = 5
66
66
67
67
# Retrieve the top k closest features to the query vector
68
68
69
- feature_values = feature_store.retrieve_online_documents (
69
+ feature_values = feature_store.retrieve_online_documents_v2 (
70
70
features=["my_feature"],
71
71
query=query_vector,
72
- top_k=top_k
72
+ top_k=top_k,
73
73
)
74
74
```
75
75
{% endcode %}
@@ -79,17 +79,32 @@ Currently, the indexing mapping in the ElasticSearch online store is configured
79
79
80
80
{% code title="indexing_mapping" %}
81
81
``` 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" },
93
108
},
94
109
}
95
110
```
0 commit comments