You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
I executed exact nearest neighbor search:
(I also tried with POST) GET my-knn-index-1/_search { "size": 4, "query": { "script_score": { "query": { "match_all": {} }, "script": { "source": "knn_score", "lang": "knn", "params": { "field": "my_vector2", "query_value": [2.0, 3.0, 5.0, 6.0], "space_type": "cosinesimil" } } } } }
As a result I received "query_shard_exception" error:
"failed to create query: class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')"
Full message: { - "error": { - "root_cause": [ - { - "type": "query_shard_exception", "reason": "failed to create query: class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')", "index_uuid": "2NpJ7PToT0SVy_YBsgmj-Q", "index": "my-knn-index-1" } ], "type": "search_phase_execution_exception", "reason": "all shards failed", "phase": "query", "grouped": true, "failed_shards": [ - { - "shard": 0, "index": "my-knn-index-1", "node": "u-6Qa_8HRW-unHxtYe5liw", "reason": { - "type": "query_shard_exception", "reason": "failed to create query: class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')", "index_uuid": "2NpJ7PToT0SVy_YBsgmj-Q", "index": "my-knn-index-1", "caused_by": { - "type": "class_cast_exception", "reason": "class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')" } } } ] }, "status": 400 }
The text was updated successfully, but these errors were encountered:
ymirchev
changed the title
Failed to execute tutorial https://opendistro.github.io/for-elasticsearch-docs/docs/knn/knn-score-script/ on AWS ElasticSearch
Failed to execute tutorial of exact nearest neighbor search on AWS ElasticSearch
Jul 25, 2021
I tried tutorial described in https://opendistro.github.io/for-elasticsearch-docs/docs/knn/knn-score-script/
on AWS ElasticSearch but got error.
Here are the steps:
I created index:
PUT my-knn-index-1 { "mappings": { "properties": { "my_vector1": { "type": "knn_vector", "dimension": 2 }, "my_vector2": { "type": "knn_vector", "dimension": 4 } } } }
I inserted data:
POST _bulk { "index": { "_index": "my-knn-index-1", "_id": "1" } } { "my_vector1": [1.5, 2.5], "price": 12.2 } { "index": { "_index": "my-knn-index-1", "_id": "2" } } { "my_vector1": [2.5, 3.5], "price": 7.1 } { "index": { "_index": "my-knn-index-1", "_id": "3" } } { "my_vector1": [3.5, 4.5], "price": 12.9 } { "index": { "_index": "my-knn-index-1", "_id": "4" } } { "my_vector1": [5.5, 6.5], "price": 1.2 } { "index": { "_index": "my-knn-index-1", "_id": "5" } } { "my_vector1": [4.5, 5.5], "price": 3.7 } { "index": { "_index": "my-knn-index-1", "_id": "6" } } { "my_vector2": [1.5, 5.5, 4.5, 6.4], "price": 10.3 } { "index": { "_index": "my-knn-index-1", "_id": "7" } } { "my_vector2": [2.5, 3.5, 5.6, 6.7], "price": 5.5 } { "index": { "_index": "my-knn-index-1", "_id": "8" } } { "my_vector2": [4.5, 5.5, 6.7, 3.7], "price": 4.4 } { "index": { "_index": "my-knn-index-1", "_id": "9" } } { "my_vector2": [1.5, 5.5, 4.5, 6.4], "price": 8.9 }
I executed exact nearest neighbor search:
(I also tried with POST)
GET my-knn-index-1/_search { "size": 4, "query": { "script_score": { "query": { "match_all": {} }, "script": { "source": "knn_score", "lang": "knn", "params": { "field": "my_vector2", "query_value": [2.0, 3.0, 5.0, 6.0], "space_type": "cosinesimil" } } } } }
As a result I received "query_shard_exception" error:
"failed to create query: class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')"
Full message:
{ - "error": { - "root_cause": [ - { - "type": "query_shard_exception", "reason": "failed to create query: class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')", "index_uuid": "2NpJ7PToT0SVy_YBsgmj-Q", "index": "my-knn-index-1" } ], "type": "search_phase_execution_exception", "reason": "all shards failed", "phase": "query", "grouped": true, "failed_shards": [ - { - "shard": 0, "index": "my-knn-index-1", "node": "u-6Qa_8HRW-unHxtYe5liw", "reason": { - "type": "query_shard_exception", "reason": "failed to create query: class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')", "index_uuid": "2NpJ7PToT0SVy_YBsgmj-Q", "index": "my-knn-index-1", "caused_by": { - "type": "class_cast_exception", "reason": "class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')" } } } ] }, "status": 400 }
The text was updated successfully, but these errors were encountered: