# Index Operations

**URL:** <https://discuss.elastic.co/t/index-operations/75158>\
**Category:** Elasticsearch\
**Created:** [February 15, 2017, 8:27am UTC](https://discuss.elastic.co/t/index-operations/75158 "2017-02-15T08:27:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [February 15, 2017, 8:27am UTC](https://discuss.elastic.co/t/index-operations/75158/1 "2017-02-15T08:27:33Z")

</div>

I am currently trying to make setting in my index just like below

```
PUT my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "my_analyzer": {
          "type": "edge_ngram",
          "min_gram": 1,
          "max_gram": "20"
        }
      }
    }
  }
}   

```

What should I modify in the php file so that I can apply the above setting in my index?

```
require 'vendor/autoload.php';

//$set=$_PUT['p'];

//set host
$hosts =['my_host'];

//
$client = Elasticsearch\ClientBuilder::create()->setHosts($hosts)->build();

// Set the index
$params = [
    'index' => 'my_index',
        'body' => [
            'settings' => [
                'analysis' =>
                    'my_analyzer': [ 
                        'type'=>'edge_ngram',
                        'min_gram'=> 1,
                        'max_gram'=> 20
                        ]
                    ],
                ]
    ];

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

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [February 15, 2017, 9:17am UTC](https://discuss.elastic.co/t/index-operations/75158/2 "2017-02-15T09:17:03Z")

</div>

> [@Greentea](#):
>
> $response = $client-\>indices()-\>putSettings($params);

Not very familiar with the PHP client but the difference seems to be here. I suspect this is calling the `PUT my_index/_settings` endpoint rather than `PUT my_index`. There is probably another function that allows you to call `PUT my_index`.

---

<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:** [March 15, 2017, 9:17am UTC](https://discuss.elastic.co/t/index-operations/75158/3 "2017-03-15T09:17:06Z")

</div>

Closed on March 15, 2017, 9:17am UTC

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