Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vector search error when the target index is empty #111733

Closed
TomonoriSoejima opened this issue Aug 9, 2024 · 1 comment · Fixed by #111756
Closed

vector search error when the target index is empty #111733

TomonoriSoejima opened this issue Aug 9, 2024 · 1 comment · Fixed by #111756
Assignees
Labels
>bug :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch

Comments

@TomonoriSoejima
Copy link
Contributor

Elasticsearch Version

8.14.3

Installed Plugins

No response

Java Version

bundled

OS Version

CentOS 9

Problem Description

Executing this request results in 400 error.
This is because the index is empty.

GET /esre-team-test-chunks/_search
{
  "fields": [
    "text"
  ],
  "knn": {
    "field": "text_embedding",
    "k": 10,
    "num_candidates": 100,
    "query_vector_builder": {
      "text_embedding": {
        "model_id": ".multilingual-e5-small",
        "model_text": "test"
      }
    }
  }
}
  • response.
{
  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": """failed to create query: Cannot invoke "java.lang.Integer.intValue()" because "this.dims" is null""",
        "index_uuid": "z60wltlVSa-kfCZsAAapOA",
        "index": "esre-team-test-chunks"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "dfs",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "esre-team-test-chunks",
        "node": "oTp_Zo49QByHhOB0DDJP_g",
        "reason": {
          "type": "query_shard_exception",
          "reason": """failed to create query: Cannot invoke "java.lang.Integer.intValue()" because "this.dims" is null""",
          "index_uuid": "z60wltlVSa-kfCZsAAapOA",
          "index": "esre-team-test-chunks",
          "caused_by": {
            "type": "null_pointer_exception",
            "reason": """Cannot invoke "java.lang.Integer.intValue()" because "this.dims" is null"""
          }
        }
      }
    ]
  },
  "status": 400
}

Steps to Reproduce

  • Please try this script in Dev tools.
DELETE esre-team-test-chunks

PUT esre-team-test-chunks
{
  "mappings": {
    "dynamic_templates": [],
    "properties": {
      "metadata": {
        "properties": {
          "esre": {
            "properties": {
              "created_at": {
                "type": "date"
              },
              "embedding_model": {
                "type": "text"
              },
              "file_id": {
                "type": "text"
              },
              "team_id": {
                "type": "text"
              },
              "updated_at": {
                "type": "date"
              }
            }
          },
          "source": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      },
      "text": {
        "type": "text",
        "fields": {
          "ngram": {
            "type": "text"
          }
        }
      },
      "text_embedding": {
        "type": "dense_vector",
        "index": true,
        "similarity": "cosine"
      }
    }
  }
}


PUT _inference/text_embedding/my-e5-model
{
  "service": "elasticsearch",
  "service_settings": {
    "num_allocations": 1,
    "num_threads": 1,
    "model_id": ".multilingual-e5-small"
  }
}



GET /esre-team-test-chunks/_search
{
  "fields": [
    "text"
  ],
  "knn": {
    "field": "text_embedding",
    "k": 10,
    "num_candidates": 100,
    "query_vector_builder": {
      "text_embedding": {
        "model_id": ".multilingual-e5-small",
        "model_text": "test"
      }
    }
  }
}

Logs (if relevant)

No response

@TomonoriSoejima TomonoriSoejima added >bug needs:triage Requires assignment of a team area label labels Aug 9, 2024
@jimczi jimczi added :Search Relevance/Vectors Vector search and removed needs:triage Requires assignment of a team area label labels Aug 9, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Aug 9, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search Relevance/Vectors Vector search Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants