Get a model

To retrieve information about a model, you can:

Get a model by ID

You can retrieve model information using the model_id.

For information about user access for this API, see Model access control considerations.

Path and HTTP methods

  1. GET /_plugins/_ml/models/<model-id>

Example request

  1. GET /_plugins/_ml/models/N8AE1osB0jLkkocYjz7D

copy

Example response

  1. {
  2. "name" : "all-MiniLM-L6-v2_onnx",
  3. "algorithm" : "TEXT_EMBEDDING",
  4. "version" : "1",
  5. "model_format" : "TORCH_SCRIPT",
  6. "model_state" : "LOADED",
  7. "model_content_size_in_bytes" : 83408741,
  8. "model_content_hash_value" : "9376c2ebd7c83f99ec2526323786c348d2382e6d86576f750c89ea544d6bbb14",
  9. "model_config" : {
  10. "model_type" : "bert",
  11. "embedding_dimension" : 384,
  12. "framework_type" : "SENTENCE_TRANSFORMERS",
  13. "all_config" : """{"_name_or_path":"nreimers/MiniLM-L6-H384-uncased","architectures":["BertModel"],"attention_probs_dropout_prob":0.1,"gradient_checkpointing":false,"hidden_act":"gelu","hidden_dropout_prob":0.1,"hidden_size":384,"initializer_range":0.02,"intermediate_size":1536,"layer_norm_eps":1e-12,"max_position_embeddings":512,"model_type":"bert","num_attention_heads":12,"num_hidden_layers":6,"pad_token_id":0,"position_embedding_type":"absolute","transformers_version":"4.8.2","type_vocab_size":2,"use_cache":true,"vocab_size":30522}"""
  14. },
  15. "created_time" : 1665961344044,
  16. "last_uploaded_time" : 1665961373000,
  17. "last_loaded_time" : 1665961815959,
  18. "total_chunks" : 9
  19. }

Search for a model

Use this command to search for models you’ve already created.

The response will contain only those model versions to which you have access. For example, if you send a match all query, model versions for the following model group types will be returned:

  • All public model groups in the index.
  • Private model groups for which you are the model owner.
  • Model groups that share at least one backend role with your backend roles.

For more information, see Model access control.

Path and HTTP methods

  1. GET /_plugins/_ml/models/_search
  2. POST /_plugins/_ml/models/_search

Example request: Searching for all models

  1. POST /_plugins/_ml/models/_search
  2. {
  3. "query": {
  4. "match_all": {}
  5. },
  6. "size": 1000
  7. }

copy

Example request: Searching for models with algorithm “FIT_RCF”

  1. POST /_plugins/_ml/models/_search
  2. {
  3. "query": {
  4. "term": {
  5. "algorithm": {
  6. "value": "FIT_RCF"
  7. }
  8. }
  9. }
  10. }

copy

Example response

  1. {
  2. "took" : 8,
  3. "timed_out" : false,
  4. "_shards" : {
  5. "total" : 1,
  6. "successful" : 1,
  7. "skipped" : 0,
  8. "failed" : 0
  9. },
  10. "hits" : {
  11. "total" : {
  12. "value" : 2,
  13. "relation" : "eq"
  14. },
  15. "max_score" : 2.4159138,
  16. "hits" : [
  17. {
  18. "_index" : ".plugins-ml-model",
  19. "_id" : "-QkKJX8BvytMh9aUeuLD",
  20. "_version" : 1,
  21. "_seq_no" : 12,
  22. "_primary_term" : 15,
  23. "_score" : 2.4159138,
  24. "_source" : {
  25. "name" : "FIT_RCF",
  26. "version" : 1,
  27. "content" : "xxx",
  28. "algorithm" : "FIT_RCF"
  29. }
  30. },
  31. {
  32. "_index" : ".plugins-ml-model",
  33. "_id" : "OxkvHn8BNJ65KnIpck8x",
  34. "_version" : 1,
  35. "_seq_no" : 2,
  36. "_primary_term" : 8,
  37. "_score" : 2.4159138,
  38. "_source" : {
  39. "name" : "FIT_RCF",
  40. "version" : 1,
  41. "content" : "xxx",
  42. "algorithm" : "FIT_RCF"
  43. }
  44. }
  45. ]
  46. }
  47. }