# Import script from file

**URL:** <https://discuss.elastic.co/t/import-script-from-file/250501>\
**Category:** Kibana\
**Tags:** painless\
**Created:** [September 30, 2020, 12:25pm UTC](https://discuss.elastic.co/t/import-script-from-file/250501 "2020-09-30T12:25:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lstoneir](https://avatars.discourse-cdn.com/v4/letter/l/b9bd4f/32.png) [@lstoneir](https://discuss.elastic.co/u/lstoneir)\
**Post date:** [September 30, 2020, 12:25pm UTC](https://discuss.elastic.co/t/import-script-from-file/250501/1 "2020-09-30T12:25:57Z")

</div>

```auto
"script": {
                "source": " very big script code",
                "lang":"painless"
}

```

i have a script with huge source code! is there any way to import script from external file?  
i want to write script code with vscode and save in a file! and then import to my query.

---

<div class="post-metadata">

**Author:** ![matw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matw/32/13913_2.png) [@matw](https://discuss.elastic.co/u/matw)\
**Post date:** [September 30, 2020, 1:16pm UTC](https://discuss.elastic.co/t/import-script-from-file/250501/2 "2020-09-30T13:16:27Z")

</div>

Hi

Unfortunately this is currently not possible, however you can use `"""` for multiline statements like this.

```
GET _search
{"query": {
    "function_score": {
      "script_score": {
        "script": {
          "lang": "painless",
          "source": """
            int total = 0;
            total += 2;
            return total;
          """
        }
      }
    }
  }
}

```

Or you can remove newlines of you code before pasting it. But I do agree that importing a file would be more comfortable.

Best,  
Matthias

---

<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 28, 2020, 1:16pm UTC](https://discuss.elastic.co/t/import-script-from-file/250501/3 "2020-10-28T13:16:29Z")

</div>

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