How to set the anlyzer in a unit test


(John Chang) #1

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


(system) #2