How to use a specific analyzer in ElasticSearch when using the Java API

I am trying to run a specific search in ElasticSearch using the Java API. It works well, but I need to use a snowball analyzer.

I really want to implement this search: http: // localhost: 9200 / myindex / myfeed / _search? Q = myterm: myvalue & analyzer = myanalyzer using the Java API.

I use TransportClient with many different types of requests (filtered, matches everything, text). I run several search queries in bulk.

I don’t see anything in the analyzer in SearchRequestBuilder. Am I looking in the wrong place?

+3
source share
1 answer

Your request will be translated into

    client.prepareSearch("myindex", "myfeed")
            .setQuery(
                    QueryBuilders.queryString("myterm:myvalue")
                            .analyzer("myanalyzer")
            )
            .execute()
            .actionGet();

, Rest API JavaAPI, Rest??? Action, ??? . , , RestSearchAction.java. API Java elasticsearch .

+5

All Articles