# Painless in score context doesn't work with more\_like\_this query

**URL:** <https://discuss.elastic.co/t/painless-in-score-context-doesnt-work-with-more-like-this-query/249821>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [September 24, 2020, 1:25pm UTC](https://discuss.elastic.co/t/painless-in-score-context-doesnt-work-with-more-like-this-query/249821 "2020-09-24T13:25:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sangmin\_Lee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sangmin_lee/32/45032_2.png) [@Sangmin\_Lee](https://discuss.elastic.co/u/Sangmin_Lee)\
**Post date:** [September 24, 2020, 1:25pm UTC](https://discuss.elastic.co/t/painless-in-score-context-doesnt-work-with-more-like-this-query/249821/1 "2020-09-24T13:25:22Z")

</div>

Hi.  
To get a score of my query, I used this painless query below.  
But it doesn't work.

```auto
    GET _scripts/painless/_execute
    {
    "script": {
        "source": "_score"
    },
    "context": "score",
    "context_setup": {
        "index": "review",
        "document": {
          "content": "He was great. It was very professional like the Elasticsearch folks."
        },
        "query": {
          "more_like_this": {
            "fields": [
                "content"
            ],
            "like": "He was great. It was very professional like the Elasticsearch folks."
          }
        }
    }
    }

```

And I got this error message,

```auto
    {
      "error" : {
        "root_cause" : [
          {
            "type" : "null_pointer_exception",
            "reason" : null
          }
        ],
        "type" : "null_pointer_exception",
        "reason" : null
      },
      "status" : 500
    }

```

I don't know the reason.  
What could be wrong?

---

<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:** [October 22, 2020, 1:25pm UTC](https://discuss.elastic.co/t/painless-in-score-context-doesnt-work-with-more-like-this-query/249821/2 "2020-10-22T13:25:42Z")

</div>

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