RequestError(400, ‘search_phase_execution_exception’, “failed to create query: Field ‘embedding’ is not knn_vector type.”)

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser): OpenSearch latest docker image

Describe the issue: Trying to run the code on this blog, https://opensearch.org/blog/deepseek-integration-rag/ and everything always works fine when creating index and indexing, but when I search I get the error: RequestError(400, ‘search_phase_execution_exception’, “failed to create query: Field ‘embedding’ is not knn_vector type.”)

Also is there any documentation that tells me what schema is followed to write the index and how to write the search mapping? (those dictionaries with seemingly arbitrary key:value)

Configuration: Windows 10, WSL, Running Docker latest opensearch image, Python 3.12

Relevant Logs or Screenshots: RequestError(400, ‘search_phase_execution_exception’, “failed to create query: Field ‘embedding’ is not knn_vector type.”)

@waddling23401 Could you share your search query and your target index mappings?

GET <your_index>/_mappings

Exactly whats used in the blog linked…

@waddling23401 I’ve tested the Python script from that blog. If you used the same Python script, then the index must have the following mappings

{
  "documents": {
    "mappings": {
      "properties": {
        "embedding": {
          "type": "knn_vector",
          "dimension": 384,
          "method": {
            "engine": "faiss",
            "space_type": "innerproduct",
            "name": "hnsw",
            "parameters": {}
          }
        },
        "metadata": {
          "type": "object"
        },
        "text": {
          "type": "text"
        }
      }
    }
  }
}

When you search the index, you should see embeddings.

{
  "took": 22,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 10,
      "relation": "eq"
    },
    "max_score": 1,
    "hits": [
      {
        "_index": "documents",
        "_id": "1",
        "_score": 1,
        "_source": {
          "text": "OpenSearch is an open source search and analytics engine.",
          "embedding": [
            -0.015524561,
            -0.02908517,
            -0.10454599,
            0.06307884,
            0.044121593,
            0.011631343,
            -0.08361524,

Could you confirm in your OpenSearch cluster?