How to set the anlyzer in a unit test.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to set the anlyzer in a unit test.

John Chang
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", "<name of analyzer provider>")
and
                .put("index_analyzer", "<name of analyzer provider>")
But neither worked.  

Thanks,
John