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
The `semantic` query uses default settings for searching on `semantic_text` fields for ease of use.
127
-
If you want to fine-tune a search on a `semantic_text` field, you need to know the task type used by the `inference_id` configured in `semantic_text`.
128
-
You can find the task type using the <<get-inference-api>>, and check the `task_type` associated with the {infer} service.
129
-
Depending on the `task_type`, use either the <<query-dsl-sparse-vector-query,`sparse_vector`>> or the <<query-dsl-knn-query,`knn`>> query for greater flexibility and customization.
130
-
131
-
NOTE: While it is possible to use the `sparse_vector` query or the `knn` query
132
-
on a `semantic_text` field, it is not supported to use the `semantic_query` on a
133
-
`sparse_vector` or `dense_vector` field type.
134
-
135
-
136
-
[discrete]
137
-
[[search-sparse-inference]]
138
-
===== Search with `sparse_embedding` inference
139
-
140
-
When the {infer} endpoint uses a `sparse_embedding` model, you can use a <<query-dsl-sparse-vector-query,`sparse_vector` query>> on a <<semantic-text,`semantic_text`>> field in the following way:
You can customize the `sparse_vector` query to include specific settings, like <<sparse-vector-query-with-pruning-config-and-rescore-example,pruning configuration>>.
163
-
164
-
165
-
[discrete]
166
-
[[search-text-inferece]]
167
-
===== Search with `text_embedding` inference
168
-
169
-
When the {infer} endpoint uses a `text_embedding` model, you can use a <<query-dsl-knn-query,`knn` query>> on a `semantic_text` field in the following way:
"text": "There are a few foods and food groups that will help to fight inflammation and delayed onset muscle soreness (both things that are inevitable after a long, hard workout) when you incorporate them into your postworkout eats, whether immediately after your run or at a meal later in the day. Advertisement. Advertisement.",
173
-
"inference": {
174
-
"inference_id": "my-elser-endpoint",
175
-
"model_settings": {
176
-
"task_type": "sparse_embedding"
177
-
},
178
-
"chunks": [
179
-
{
180
-
"text": "There are a few foods and food groups that will help to fight inflammation and delayed onset muscle soreness (both things that are inevitable after a long, hard workout) when you incorporate them into your postworkout eats, whether immediately after your run or at a meal later in the day. Advertisement. Advertisement.",
181
-
"embeddings": {
182
-
(...)
183
-
}
184
-
}
185
-
]
186
-
}
187
-
}
188
-
}
189
-
},
190
-
{
191
-
"_index": "semantic-embeddings",
192
-
"_id": "Ji5065EBBFPLbFsdh_f9",
193
-
"_score": 18.211695,
194
-
"_source": {
195
-
"id": 8836651,
196
-
"content": {
197
-
"text": "During Your Workout. There are a few things you can do during your workout to help prevent muscle injury and soreness. According to personal trainer and writer for Iron Magazine, Marc David, doing warm-ups and cool-downs between sets can help keep muscle soreness to a minimum.",
198
-
"inference": {
199
-
"inference_id": "my-elser-endpoint",
200
-
"model_settings": {
201
-
"task_type": "sparse_embedding"
202
-
},
203
-
"chunks": [
204
-
{
205
-
"text": "During Your Workout. There are a few things you can do during your workout to help prevent muscle injury and soreness. According to personal trainer and writer for Iron Magazine, Marc David, doing warm-ups and cool-downs between sets can help keep muscle soreness to a minimum.",
206
-
"embeddings": {
207
-
(...)
208
-
}
209
-
}
210
-
]
211
-
}
212
-
}
213
-
}
214
-
},
215
-
{
216
-
"_index": "semantic-embeddings",
217
-
"_id": "Wi5065EBBFPLbFsdh_b9",
218
-
"_score": 13.089405,
219
-
"_source": {
220
-
"id": 8800197,
221
-
"content": {
222
-
"text": "This is especially important if the soreness is due to a weightlifting routine. For this time period, do not exert more than around 50% of the level of effort (weight, distance and speed) that caused the muscle groups to be sore.",
223
-
"inference": {
224
-
"inference_id": "my-elser-endpoint",
225
-
"model_settings": {
226
-
"task_type": "sparse_embedding"
227
-
},
228
-
"chunks": [
229
-
{
230
-
"text": "This is especially important if the soreness is due to a weightlifting routine. For this time period, do not exert more than around 50% of the level of effort (weight, distance and speed) that caused the muscle groups to be sore.",
0 commit comments