ElasticSearch in java ElasticSearch in java elasticsearch elasticsearch

ElasticSearch in java


Ok, i spent more time on documentation and i found a solution, hope it helps to someone else!You just need to use QueryBuilders.multiMatchQuery, the value is our searching word and other strings are the columns where to search to.

SearchResponse response = client.prepareSearch(index)        .setTypes(type)        .setSearchType(SearchType.QUERY_AND_FETCH)        .setQuery(QueryBuilders.multiMatchQuery(value,                "name", "address1", "city", "postalCode",                "countryCode", "airportCode", "locationDescription",                "shortDescription"        ))        .setFrom(0).setSize(100).setExplain(true)        .execute()        .actionGet();