# PHP Snowball with French

**URL:** <https://discuss.elastic.co/t/php-snowball-with-french/35025>\
**Category:** Elasticsearch\
**Created:** [November 19, 2015, 8:38am UTC](https://discuss.elastic.co/t/php-snowball-with-french/35025 "2015-11-19T08:38:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tybreizh29190](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tybreizh29190](https://discuss.elastic.co/u/tybreizh29190)\
**Post date:** [November 19, 2015, 8:38am UTC](https://discuss.elastic.co/t/php-snowball-with-french/35025/1 "2015-11-19T08:38:05Z")

</div>

Hi  
I want to apply Snowball to my field "word" which is a simple word in French.  
Just below are my mapping and my settings, and at the bottom it's the function I want to call to apply Snowball to my field.  
It's not working, first putSettings want me to put the body field (I don't understand why), and if I add the body field I get the message ""Validation Failed: 1: no settings to update;"", just to prove me I'm not doing the right way.  
What should I change to make it work ?  
thanks  
marc

> getMapping

> Array (1)  
> (  
> | ['msf'] =\> Array (1)  
> | (  
> | | ['mappings'] =\> Array (1)  
> | | (  
> | | | ['transcription'] =\> Array (1)  
> | | | (  
> | | | | ['properties'] =\> Array (9)  
> ...  
> | | | | | ['content'] =\> Array (2)  
> | | | | | (  
> | | | | | | ['type'] = String(6) "string"  
> | | | | | | ['analyzer'] = String(8) "snowball"  
> | | | | | )  
> ...

> getSettings

> Array (1)  
> (  
> | ['msf'] =\> Array (1)  
> | (  
> | | ['settings'] =\> Array (1)  
> | | (  
> | | | ['index'] =\> Array (5)  
> | | | (  
> | | | | ['creation\_date'] = String(13) "1447860568133"  
> | | | | ['uuid'] = String(22) "-yL6l3htS-SO\_t4LK1Iehg"  
> | | | | ['number\_of\_replicas'] = String(1) "1"  
> | | | | ['number\_of\_shards'] = String(1) "5"  
> | | | | ['version'] =\> Array (1)  
> | | | | (  
> | | | | | ['created'] = String(7) "2000099"  
> | | | | )  
> | | | )  
> | | )  
> | )  
> )

my code that is supposed to do the job ...

```
$params = [
    "index" => [
         "analysis" => [
             "analyzer" => [
                 "msf_analyzer" => [
                     "tokenizer" => "standard",
                     "filter" => ["standard", "lowercase", "msf_filter"]
                 ]
             ],
             "filter" => [
                 "msf_filter" => [
                     "type" => "snowball",
                     "language" => "French"
                 ]
             ]
         ]
     ],
    'body' => []
 ];

$response = $client->indices()->putSettings($params);

```

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [November 19, 2015, 3:00pm UTC](https://discuss.elastic.co/t/php-snowball-with-french/35025/2 "2015-11-19T15:00:28Z")

</div>

The ES-PHP client is a "low level" client which closely emulates the HTTP API. Meaning the JSON that normally goes into the HTTP request body goes inside `body` of the PHP request. Try this instead:

```php
$params = [
    'index' => 'my_index',
    'body' => [
         "analysis" => [
             "analyzer" => [
                 "msf_analyzer" => [
                     "tokenizer" => "standard",
                     "filter" => ["standard", "lowercase", "msf_filter"]
                 ]
             ],
             "filter" => [
                 "msf_filter" => [
                     "type" => "snowball",
                     "language" => "French"
                 ]
             ]
         ]
      ]
 ];

$response = $client->indices()->putSettings($params);

```

Notice how the index name goes into `index`, while the JSON request body goes into `body`.

---

<div class="post-metadata">

**Author:** ![tybreizh29190](https://avatars.discourse-cdn.com/v4/letter/t/b5a626/32.png) [@tybreizh29190](https://discuss.elastic.co/u/tybreizh29190)\
**Post date:** [November 20, 2015, 10:35am UTC](https://discuss.elastic.co/t/php-snowball-with-french/35025/3 "2015-11-20T10:35:27Z")

</div>

Thanks Zachary.  
It's better for the request.  
I've got an exception.  
Each time I had it during my previous tests, the only solution I found was to delete the index and recreate a new index with new settings. I read a solution that uses index alias to modify the index ...  
Is there a simple way to apply snowball with putSettings without restarting from 0.

[Fri Nov 20 11:30:21.259172 2015] [:error] [pid 17675] [client 10.229.100.7:49186] PHP Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":{"root\_cause":[{"type":"illegal\_argument\_exception","reason":"Can't update non dynamic settings[[index.analysis.filter.msf\_filter.type, index.analysis.filter.msf\_filter.language, index.analysis.analyzer.msf\_analyzer.filter.0, index.analysis.analyzer.msf\_analyzer.filter.2, index.analysis.analyzer.msf\_analyzer.filter.1, index.analysis.analyzer.msf\_analyzer.tokenizer]] for open indices [[msf]]"}],"type":"illegal\_argument\_exception","reason":"Can't update non dynamic settings[[index.analysis.filter.msf\_filter.type, index.analysis.filter.msf\_filter.language, index.analysis.analyzer.msf\_analyzer.filter.0, index.analysis.analyzer.msf\_analyzer.filter.2, index.analysis.analyzer.msf\_analyzer.filter.1, index.analysis.analyzer.msf\_analyzer.tokenizer]] for open indices [[msf]]"},"status":400}' in /opt/MSF/development/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php:613\nStack trace:\n#0 in /opt/MSF/development/www/html/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 615

---

<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:** [July 5, 2017, 11:36pm UTC](https://discuss.elastic.co/t/php-snowball-with-french/35025/4 "2017-07-05T23:36:57Z")

</div>


