# Not sure how to enable painless regex

**URL:** <https://discuss.elastic.co/t/not-sure-how-to-enable-painless-regex/231806>\
**Category:** Elasticsearch\
**Created:** [May 8, 2020, 10:19pm UTC](https://discuss.elastic.co/t/not-sure-how-to-enable-painless-regex/231806 "2020-05-08T22:19:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![skazan](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@skazan](https://discuss.elastic.co/u/skazan)\
**Post date:** [May 8, 2020, 10:19pm UTC](https://discuss.elastic.co/t/not-sure-how-to-enable-painless-regex/231806/1 "2020-05-08T22:19:07Z")

</div>

Hi,

I want to enable regex for painless script as it is not enabled by default and hence my scripted field is failing to create. I added "script.painless.regex.enabled" under env section of elasticsearch.yaml file (please see below) that I pass into helm install command but it doesn't work, I am not sure this is syntactically correct. To verify if this setting is taken effect, I enter container and explore content of /usr/share/elasticsearch/config/elasticsearch.yml hoping to see "script.painless.regex.enabled" setting there but I don't see it.

Any thoughts on this is very appreciated.

helm install --namespace logging elasticsearch elastic/elasticsearch -f /root/elk/elasticsearch.yaml

**/root/elk/elasticsearch.yaml**

```
imageTag: 7.4.1
replicas: 1
esJavaOpts: "-Xmx256m -Xms256m"
resources:
  requests:
    cpu: "100m"
    memory: "1G"
  limits:
    cpu: "1000m"
    memory: "1G"

env:
  - name: script.painless.regex.enabled
    value: "true"

```

Thanks  
/Sam

---

<div class="post-metadata">

**Author:** ![Luca\_Belluccini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_belluccini/32/33239_2.png) [@Luca\_Belluccini](https://discuss.elastic.co/u/Luca_Belluccini)\
**Post date:** [May 9, 2020, 12:50am UTC](https://discuss.elastic.co/t/not-sure-how-to-enable-painless-regex/231806/2 "2020-05-09T00:50:01Z")

</div>

Hello,  
Maybe you might find interesting the [Elastic helm charts](https://github.com/elastic/helm-charts/blob/master/elasticsearch/README.md).

Anyway, there are 2 ways to customize the configuration:

- editing the `elasticsearch.yml`
- using environment variables

Please check if you've correctly enabled the setting using `GET /_cluster/settings?include_defaults=true`. You should see if it's enabled or not.

---

<div class="post-metadata">

**Author:** ![skazan](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@skazan](https://discuss.elastic.co/u/skazan)\
**Post date:** [May 9, 2020, 12:00pm UTC](https://discuss.elastic.co/t/not-sure-how-to-enable-painless-regex/231806/3 "2020-05-09T12:00:33Z")

</div>

Perfect. Thanks a lot Luca, it worked. This is what I added:

```
esConfig:
  elasticsearch.yml: |
    script.painless.regex.enabled: true
```

---

<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:** [June 6, 2020, 12:00pm UTC](https://discuss.elastic.co/t/not-sure-how-to-enable-painless-regex/231806/4 "2020-06-06T12:00:34Z")

</div>

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