Index of every page on this site: llms.txt
All skills
Run it yourself

Build search applications and query log analytics data with OpenSearch. Use this skill when the user mentions OpenSearch, search app, index setup, search architecture, semantic search, vector search, hybrid search, BM25, dense vector, sparse vector, agentic search, RAG, embeddings, KNN, PDF ingestion, document processing, or any related search topic. Also use for log analytics and observability — when the user wants to set up log ingestion, query logs with PPL, analyze error patterns, set up index lifecycle policies, investigate traces, or check stack health. Activate even if the user says log analysis, Fluent Bit, Fluentd, Logstash, syslog, traceId, OpenTelemetry, or log analytics without mentioning OpenSearch.

Use this Skill: https://skilld.dev/gh/opensearch-project/opensearch-agent-skills/opensearch-skills

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

cloudaws-setupaossserverless-02-deploy-search.md

≈2.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Amazon OpenSearch Serverless — Step 2: Deploy Search Configuration

This guide covers creating indices, deploying ML models, and configuring pipelines on the serverless collection.

State Input

From .opensearch-deploy-state.json:

  • resource_endpoint: collection endpoint URL
  • search_strategy: determines which path to follow
  • principal_arn: for IAM role creation (dense vector path)

From prepare_aws_deployment() output:

  • local_config.text_fields: fields to configure for search
  • plan_summary.solution: full architecture plan

Route by Strategy

  • Neural Sparse — follow "Neural Sparse Path" below
  • Dense Vector or Hybrid — follow "Dense Vector Path" below
  • BM25 — follow "BM25 Path" below

Neural Sparse Path (Automatic Semantic Enrichment)

Create Index with Semantic Enrichment

Use AWS API MCP to create the index with automatic enrichment:

POST /opensearchserverless/CreateIndex
{
  "id": "<collection-id>",
  "indexName": "<index-name>",
  "indexSchema": {
    "mappings": {
      "properties": {
        "<text-field>": {
          "type": "text",
          "semantic_enrichment": {
            "status": "ENABLED",
            "language_options": "english"
          }
        }
      }
    }
  }
}

Key points:

  • Set semantic_enrichment.status to "ENABLED" on text fields for neural sparse
  • language_options: "english" or "multi-lingual"
  • System automatically deploys sparse model, creates ingest/search pipelines
  • Standard "match" queries are automatically rewritten to neural sparse queries
  • No manual model or pipeline management required

Update state: "index_name": "<index-name>", "step_completed": "deploy-search"

Skip to "Index Sample Documents" below.


Dense Vector Path

Step 1: Create IAM Role for Bedrock

POST /iam/CreateRole
{
  "RoleName": "opensearch-bedrock-role",
  "AssumeRolePolicyDocument": {
    "Version": "2012-10-17",
    "Statement": [{
      "Effect": "Allow",
      "Principal": { "Service": "ml.opensearchservice.amazonaws.com" },
      "Action": "sts:AssumeRole"
    }]
  }
}

Attach Bedrock invoke permissions:

POST /iam/PutRolePolicy
{
  "RoleName": "opensearch-bedrock-role",
  "PolicyName": "BedrockInvokePolicy",
  "PolicyDocument": {
    "Version": "2012-10-17",
    "Statement": [{
      "Effect": "Allow",
      "Action": "bedrock:InvokeModel",
      "Resource": "arn:aws:bedrock:*::foundation-model/amazon.titan-embed-text-v2:0"
    }]
  }
}

Update state: "iam_role_arn": "<role-arn>"

Step 2: Create ML Connector

Prerequisite: The data access policy must include model ResourceType for ML operations. If it was not configured during provisioning, update the policy now: add {"Resource": ["model/<collection-name>/*"], "Permission": ["aoss:*"], "ResourceType": "model"} and add the Bedrock IAM role to Principal. Policy changes propagate within seconds; if connector creation returns a permission error, retry.

Use opensearch-mcp-server to create a Bedrock Titan connector:

POST <collection-endpoint>/_plugins/_ml/connectors/_create
{
  "name": "Amazon Bedrock Titan Embedding V2",
  "description": "Connector to Bedrock Titan embedding model",
  "version": 1,
  "protocol": "aws_sigv4",
  "parameters": {
    "region": "<aws-region>",
    "service_name": "bedrock"
  },
  "credential": {
    "roleArn": "<iam_role_arn>"
  },
  "actions": [{
    "action_type": "predict",
    "method": "POST",
    "url": "https://bedrock-runtime.<aws-region>.amazonaws.com/model/amazon.titan-embed-text-v2:0/invoke",
    "headers": { "content-type": "application/json", "x-amz-content-sha256": "required" },
    "request_body": "{ \"inputText\": \"${parameters.inputText}\" }",
    "pre_process_function": "\n    StringBuilder builder = new StringBuilder();\n    builder.append(\"\\\"\");\n    String first = params.text_docs[0];\n    builder.append(first);\n    builder.append(\"\\\"\");\n    def parameters = \"{\" +\"\\\"inputText\\\":\" + builder + \"}\";\n    return  \"{\" +\"\\\"parameters\\\":\" + parameters + \"}\";",
    "post_process_function": "\n      def name = \"sentence_embedding\";\n      def dataType = \"FLOAT32\";\n      if (params.embedding == null || params.embedding.length == 0) {\n        return params.message;\n      }\n      def shape = [params.embedding.length];\n      def json = \"{\" +\n                 \"\\\"name\\\":\\\"\" + name + \"\\\",\" +\n                 \"\\\"data_type\\\":\\\"\" + dataType + \"\\\",\" +\n                 \"\\\"shape\\\":\" + shape + \",\" +\n                 \"\\\"data\\\":\" + params.embedding +\n                 \"}\";\n      return json;\n    "
  }]
}

Update state: "connector_id": "<connector_id>"

Step 3: Register and Deploy Model

POST <collection-endpoint>/_plugins/_ml/model_groups/_register
{ "name": "bedrock_embedding_models", "description": "Bedrock embedding model group" }

Update state: "model_group_id": "<model_group_id>"

POST <collection-endpoint>/_plugins/_ml/models/_register
{
  "name": "bedrock-titan-embed-v2",
  "function_name": "remote",
  "description": "Bedrock Titan Text Embeddings V2",
  "model_group_id": "<model_group_id>",
  "connector_id": "<connector_id>"
}
POST <collection-endpoint>/_plugins/_ml/models/<model-id>/_deploy

Test: POST <collection-endpoint>/_plugins/_ml/models/<model-id>/_predict with {"parameters": {"inputText": "hello world"}}. Verify 1024-dimensional embeddings.

Update state: "model_id": "<model_id>"

Step 4: Create Ingest Pipeline

PUT <collection-endpoint>/_ingest/pipeline/bedrock-embedding-pipeline
{
  "description": "Bedrock Titan embedding pipeline",
  "processors": [{
    "text_embedding": {
      "model_id": "<model_id>",
      "field_map": { "<text-field>": "<vector-field>" }
    }
  }]
}

Update state: "ingest_pipeline_name": "bedrock-embedding-pipeline"

Step 5: Create Index

PUT <collection-endpoint>/<index-name>
{
  "settings": {
    "index.knn": true,
    "index.default_pipeline": "bedrock-embedding-pipeline"
  },
  "mappings": {
    "properties": {
      "<text-field>": { "type": "text" },
      "<vector-field>": {
        "type": "knn_vector",
        "dimension": 1024
      }
    }
  }
}

Note: Omit engine/mode on NextGen — they are rejected with Field parameter 'engine' is not supported. space_type is optional (defaults to L2); to use another metric, add it at the field level, e.g. "space_type": "cosinesimil".

Update state: "index_name": "<index-name>"

Step 6: Create Search Pipeline (hybrid search only)

If search strategy is "hybrid":

PUT <collection-endpoint>/_search/pipeline/hybrid-search-pipeline
{
  "description": "Hybrid search with normalization",
  "phase_results_processors": [{
    "normalization-processor": {
      "normalization": { "technique": "min_max" },
      "combination": { "technique": "arithmetic_mean", "parameters": { "weights": [0.3, 0.7] } }
    }
  }]
}

Update state: "search_pipeline_name": "hybrid-search-pipeline", "step_completed": "deploy-search"


BM25 Path

Create Index

Use opensearch-mcp-server to create the index with text mappings from local config:

PUT <collection-endpoint>/<index-name>
{
  "mappings": {
    "properties": {
      "<text-field>": { "type": "text" }
    }
  }
}

Include all field mappings from the local setup.

Update state: "index_name": "<index-name>", "step_completed": "deploy-search"


Index Sample Documents

After index creation (all paths):

  1. Use the same sample documents from Phase 1
  2. Index a few test documents to verify the setup
  3. Test search queries:
    • Neural Sparse: use standard match queries (automatically rewritten)
    • Dense Vector: use neural query with model_id
    • BM25: use standard match queries

Launch Search UI with AWS Endpoint

After deployment is complete, launch the Search Builder UI pointing at the AWS collection:

uv run python scripts/opensearch_ops.py launch-ui \
  --index <index-name> \
  --endpoint <collection-endpoint> \
  --aws-region <region> \
  --aws-service aoss

The UI header badge will change from "Local" to "AWS Cloud" with a green connection indicator.

Provide Access Information

Give the user:

  • Collection endpoint URL
  • Collection ARN
  • Dashboard URL (if applicable)
  • Sample search queries to test
  • Search Builder UI URL (already connected to AWS endpoint)

State Output

Final state update:

{
  "step_completed": "deploy-search",
  "index_name": "<index-name>",
  "iam_role_arn": "<if created>",
  "connector_id": "<if created>",
  "model_id": "<if created>",
  "ingest_pipeline_name": "<if created>",
  "search_pipeline_name": "<if created>"
}

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 alert3d4 checks · Risk SAFE
  • Gen Agent Trust Hub5d

    The skill provides a comprehensive set of tools for OpenSearch development, including data ingestion, deployment to AWS/Aiven, and observability analytics. It implements robust security measures such as SSRF protection for remote data loading. Potential security considerations include the ingestion of unstructured data (Indirect Prompt Injection surface) and the transmission of feedback to a third-party domain.

  • Socket3d

    5 alerts: gptSecurity, gptAnomaly

  • Snyk5d

    Risk: CRITICAL · 3 issues

  • ZeroLeaks7mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at c4f7b1e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 6 days ago
compatibility
Requires Docker and uv. AWS deployment requires AWS credentials.
metadata
{
  "author": "opensearch-project",
  "version": "2.0"
}

README badge

README badge for opensearch-project/opensearch-agent-skills/opensearch-skills