# How to set the anlyzer in a unit test

**URL:** <https://discuss.elastic.co/t/how-to-set-the-anlyzer-in-a-unit-test/3013>\
**Category:** Elasticsearch\
**Created:** [June 10, 2010, 11:31pm UTC](https://discuss.elastic.co/t/how-to-set-the-anlyzer-in-a-unit-test/3013 "2010-06-10T23:31:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Chang](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@John\_Chang](https://discuss.elastic.co/u/John_Chang)\
**Post date:** [June 10, 2010, 11:31pm UTC](https://discuss.elastic.co/t/how-to-set-the-anlyzer-in-a-unit-test/3013/1 "2010-06-10T23:31:37Z")

</div>

I can set the analyzer with a custom analyzer provider when starting up the server. How do I do it when starting up a node for a unit test? In my unit test, I start it up this way:

```
    Node hostNode = NodeBuilder.nodeBuilder().loadConfigSettings(false).clusterName("test.cluster").local(true).settings(
            ImmutableSettings.settingsBuilder()
            .put("index.number_of_shards", 1)
            .put("index.number_of_replicas", 1).build()
    ).node().start();
    Client elasticSearchClient = hostNode.client();

```

How do I control the analyzer? I tried adding:  
.put("analyzer", "")  
and  
.put("index\_analyzer", "")  
But neither worked.

Thanks,  
John

---

<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 6, 2017, 4:23am UTC](https://discuss.elastic.co/t/how-to-set-the-anlyzer-in-a-unit-test/3013/2 "2017-07-06T04:23:21Z")

</div>

Closed on July 6, 2017, 4:23am UTC


