How to used XContentFilterBuilder?


(Sam-4) #1

Hi

I want to define token filter using java.can any one help me how to
used XContentFilterBuilder class to define filter and if possible
please explain with example.

used token filter what i want to used on search query:

type: stop
stopwords_path="d:\resouces\stopwords_eng.txt
ignore_case=true

I am using following java code to search data:
String indexName="test1";
String indexType="type1";
String data="is";
QueryStringQueryBuilder querystring = new
QueryStringQueryBuilder(data);
SearchResponse searchResponse =
client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchTyp
e.DEFAULT)
.setQuery(querystring.analyzer("whitespace"))
.setFilter(...............) ////Here needs to
define token filter
*****
.setSize(100).execute().action Get();

please help me.

Thanks


(Shay Banon) #2

Use the FilterBuilders factory to create filters (similar to QueryBuilders).

On Mon, Jan 16, 2012 at 8:53 AM, sam mishra.sameek@gmail.com wrote:

Hi

I want to define token filter using java.can any one help me how to
used XContentFilterBuilder class to define filter and if possible
please explain with example.

used token filter what i want to used on search query:

type: stop
stopwords_path="d:\resouces\stopwords_eng.txt
ignore_case=true

I am using following java code to search data:
String indexName="test1";
String indexType="type1";
String data="is";
QueryStringQueryBuilder querystring = new
QueryStringQueryBuilder(data);
SearchResponse searchResponse =
client.prepareSearch(indexName).setTypes(indexType).setSearchType(SearchTyp
e.DEFAULT)
.setQuery(querystring.analyzer("whitespace"))
.setFilter(...............) ////Here needs to
define token filter
*****
.setSize(100).execute().action Get();

please help me.

Thanks


(system) #3