Java Code Examples for org.elasticsearch.index.query.MatchPhraseQueryBuilder#slop()
The following examples show how to use
org.elasticsearch.index.query.MatchPhraseQueryBuilder#slop() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MatchPhraseQueryDemo.java From elasticsearch-full with Apache License 2.0 | 7 votes |
@Test public void test() throws Exception { String key = "this is a"; MatchPhraseQueryBuilder matchPhraseQueryBuilder = QueryBuilders.matchPhraseQuery("title",key); matchPhraseQueryBuilder.boost(10); matchPhraseQueryBuilder.analyzer("standard"); matchPhraseQueryBuilder.slop(2); SearchResponse searchResponse = client.prepareSearch() .setIndices("my_index") .setTypes("my_type") .setQuery(matchPhraseQueryBuilder) .execute() .actionGet(); }
Example 2
Source File: Paramer.java From elasticsearch-sql with Apache License 2.0 | 5 votes |
public static ToXContent fullParamer(MatchPhraseQueryBuilder query, Paramer paramer) { if (paramer.analysis != null) { query.analyzer(paramer.analysis); } if (paramer.boost != null) { query.boost(paramer.boost); } if (paramer.slop != null) { query.slop(paramer.slop); } return query; }