Evaluate a trained model
Generally available; Added in 8.3.0
Path parameters
-
model_id
string Required The unique identifier of the trained model.
Query parameters
-
timeout
string Controls the amount of time to wait for inference results.
Values are
-1
or0
.
Body
Required
-
docs
array[object] Required An array of objects to pass to the model for inference. The objects should contain a fields matching your configured trained model input. Typically, for NLP models, the field name is
text_field
. Currently, for NLP models, only a single value is allowed. -
inference_config
object
POST
/_ml/trained_models/{model_id}/_infer
Console
POST _ml/trained_models/lang_ident_model_1/_infer
{
"docs":[{"text": "The fool doth think he is wise, but the wise man knows himself to be a fool."}]
}
resp = client.ml.infer_trained_model(
model_id="lang_ident_model_1",
docs=[
{
"text": "The fool doth think he is wise, but the wise man knows himself to be a fool."
}
],
)
const response = await client.ml.inferTrainedModel({
model_id: "lang_ident_model_1",
docs: [
{
text: "The fool doth think he is wise, but the wise man knows himself to be a fool.",
},
],
});
response = client.ml.infer_trained_model(
model_id: "lang_ident_model_1",
body: {
"docs": [
{
"text": "The fool doth think he is wise, but the wise man knows himself to be a fool."
}
]
}
)
$resp = $client->ml()->inferTrainedModel([
"model_id" => "lang_ident_model_1",
"body" => [
"docs" => array(
[
"text" => "The fool doth think he is wise, but the wise man knows himself to be a fool.",
],
),
],
]);
curl -X POST -H "Authorization: ApiKey $ELASTIC_API_KEY" -H "Content-Type: application/json" -d '{"docs":[{"text":"The fool doth think he is wise, but the wise man knows himself to be a fool."}]}' "$ELASTICSEARCH_URL/_ml/trained_models/lang_ident_model_1/_infer"
Request example
An example body for a `POST _ml/trained_models/lang_ident_model_1/_infer` request.
{
"docs":[{"text": "The fool doth think he is wise, but the wise man knows himself to be a fool."}]
}