Full text search with field="somevalue"


(bhushan15) #1

Hi,

I am using match query for full text search.I am having one property as "collectionType". I want full text search with keyword say "FRANKLIN" but collectionType="HUMAN"

Node node = NodeBuilder.nodeBuilder().node();
Client client = node.client();
//FilteredQuery q= new FilteredQuery(QueryBuilders.matchAllQuery(), AndFilter());
SearchResponse response = client.prepareSearch("my_index")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setTypes("couchbaseDocument")
.setQuery(QueryBuilders.matchQuery("_all", "FRANKLIN"))
.execute()
.actionGet();

for (SearchHit hit : response.getHits()) {
System.out.println("Id " + hit.getId() + " Index " + hit.getIndex() + " Type " +
hit.getType() + hit.getSourceAsString());
}


(system) #2