How to refer custom analyzer in search query?


(Sam-4) #1

Hi

I am using elastic server 0.16.2. i am using following java code for
creating custom analyzer:
I have created gist for used java code that create custom
analyzer(search_analyzer)

search query java code :

QueryStringQueryBuilder querystring = new
QueryStringQueryBuilder(data);
SearchResponse searchResponse =
client.prepareSearch(indexName).setSearchType(SearchType.DEFAULT)
.setQuery(querystring.analyzer("search_analyzer")).setExplain(true).setSize(100).execute().actionGet();

I have following doubt regarding custom analyzer:

  1. Is it is necessary to use same analyzer index creation and
    searching time.
  2. how to refer custom analyzer in search query.
    3.if we used following java code for define custom analyzer on
    index ,it can change previous created index mapping.

please help me and clear things.


(system) #2