# Search\_phase\_execution\_error with script\_Score n cosine similarity ES 7.15.2

**URL:** <https://discuss.elastic.co/t/search-phase-execution-error-with-script-score-n-cosine-similarity-es-7-15-2/291068>\
**Category:** Elasticsearch\
**Created:** [December 6, 2021, 3:53pm UTC](https://discuss.elastic.co/t/search-phase-execution-error-with-script-score-n-cosine-similarity-es-7-15-2/291068 "2021-12-06T15:53:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikkie](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@Nikkie](https://discuss.elastic.co/u/Nikkie)\
**Post date:** [December 6, 2021, 3:53pm UTC](https://discuss.elastic.co/t/search-phase-execution-error-with-script-score-n-cosine-similarity-es-7-15-2/291068/1 "2021-12-06T15:53:11Z")

</div>

Greetings! I had started with my Elasticsearch journey with 7.10.1 and could successfully run script\_score queries with cosine\_similarity earlier. But now when I am using 7.15 I get stuck with this error "Elasticsearch.exceptions.RequestError: RequestError(400, 'search\_phase\_execution\_exception', 'runtime error')" even for a trial dataset of 20 records. I am stuck on this for about a week, tried installing and working with earlier versions of ES too. but still same error.  
My index mapping:

```auto
  "mappings": {
          "properties": {
              "id":{"type":"long"},
              "prompt": {
                  "type": "text",
                  "analyzer": "standard",
                  "fields": {
                      "keyword": {"type": "keyword"},
                      "ngrams": {"type": "text", "analyzer": "ngram_analyzer"}
                  }
              },
            "cf": {
                "type": "keyword" },
            "entities": {
                "type": "keyword" },
            "keywords": {
                "type": "keyword" },
            "promptVec":{
                "type": "dense_vector","dims":512
            }
          }

```

My Query:

````auto
esq = {"query":{ 
 "script_score":{
            "query":{"match_all":{}},
            "script":{
                "source":"cosineSimilarity(params.qv, doc['promptVec'])+1.0",
                "params":{"qv":query_vector}
            }
        } }
    } ```
ERROR: raise HTTP_EXCEPTIONS.get(status_code, TransportError)(

elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', 'unknown query [query]')

I also tried (as debug step) to reduce no of dims to 5 and indexing only 20 records, but the same error persists. Any help is greatly appreciated
````

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 3, 2022, 3:54pm UTC](https://discuss.elastic.co/t/search-phase-execution-error-with-script-score-n-cosine-similarity-es-7-15-2/291068/2 "2022-01-03T15:54:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
