Skip to content

unable to find script [hotel_search_template] #421

@liu-xiao-guo

Description

@liu-xiao-guo

For the code at https://github.com/elastic/elasticsearch-labs/tree/main/supporting-blog-content/unifying-elastic-vector-database-and-llms-for-intelligent-query, if we run the code, and we will finally get the following error:

Elasticsearch Query:
{
  "id": "hotel_search_template",
  "params": {
    "query": "recently renovated accommodations 250m from Belongil Beach with at least 4 stars and with a pool and gym",
    "latitude": -28.6337328,
    "longitude": 153.6003455,
    "distance": "250m",
    "rating": 4,
    "countryName": "Australia",
    "countryCode": "AU",
    "attraction": "recently renovated, pool, gym"
  }
}
Error while querying Elasticsearch: NotFoundError(404, 'resource_not_found_exception', 'unable to find script [hotel_search_template] in cluster state')

If we take a look at the code, variable "search_template_content" is never used anywhere. Also, TEMPLATE_ID has no value linked to it, and it is just simply a string value which is never referred anywhere.

I changed the code as follows:

es.put_script(id=TEMPLATE_ID, body=search_template_content)

find_a_hotel(
    "recently renovated accommodations 250m from Belongil Beach with at least 4 stars and with a pool and gym"
)

Then finally, it starts to work!

Anothre small problem is that trying to delete an inference endpoint fails when the inference endpoint is referred in a index mapping.

Image Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions