Skip to content

Instantly share code, notes, and snippets.

@DagW
Created May 14, 2025 12:33
Show Gist options
  • Save DagW/4858e320a1ce14f8d8b6a2fbb633124a to your computer and use it in GitHub Desktop.
Save DagW/4858e320a1ce14f8d8b6a2fbb633124a to your computer and use it in GitHub Desktop.
Opensearch register and simulate opensearch-neural-sparse-encoding-multilingual-v1
PUT /_cluster/settings
{
"persistent": {
"plugins.ml_commons.only_run_on_ml_node": false,
"plugins.ml_commons.model_access_control_enabled": "true",
"plugins.ml_commons.native_memory_threshold": "99"
}
}
POST /_plugins/_ml/models/_register?deploy=true
{
"name": "amazon/neural-sparse/opensearch-neural-sparse-encoding-multilingual-v1",
"version": "1.0.0",
"model_format": "TORCH_SCRIPT"
}
GET /_plugins/_ml/tasks/1fvAzpYBf6BSf_XtxoXh
#{
# "model_id": "1vvAzpYBf6BSf_Xt0IU-",
# "task_type": "REGISTER_MODEL",
# "function_name": "SPARSE_ENCODING",
# "state": "COMPLETED",
# "worker_node": [
# "g_XZWqxGSz2dQOgt1iDOkQ"
# ],
# "create_time": 1747225462143,
# "last_update_time": 1747225561551,
# "is_async": true
#}
POST /_plugins/_ml/models/_search
{
}
PUT /_ingest/pipeline/sparse
{
"description": "An sparse encoding ingest pipeline",
"processors": [
{
"sparse_encoding": {
"model_id": "1vvAzpYBf6BSf_Xt0IU-",
"field_map": {
"text": "embedding"
}
}
}
]
}
POST /_ingest/pipeline/sparse/_simulate
{
"docs": [
{
"_index": "index",
"_id": "id",
"_source": {
"text": "document-name"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment