This blog is primarily focus on Java fundamentals and the libraries built on top of Java programming language. Most of the post are example oriented, hope you have fun in reading my blog....:)
Wednesday, 2 December 2015
Elasticsearch: Java: fuzzy query
Go through
following link for details fuzzy query.
QueryBuilder builder = QueryBuilders.fuzzyQuery("text", "aara").boost(1.0f).prefixLength(0).maxExpansions(100).fuzziness(Fuzziness.TWO);
Above
statement generates following fuzzy query.
{
"fuzzy" : {
"text" : {
"value" : "aara",
"boost" : 1.0,
"fuzziness" : 2,
"prefix_length" : 0,
"max_expansions" : 100
}
}
}
Elasticsearch: Java: ids query
Return documents
that have provided ids.
QueryBuilder builder = QueryBuilders.idsQuery(new String[] { "titles", "philosophy" }).ids(new String[] { "1", "4" });
Above query
generates following json document.
{
"ids" : {
"types" : [ "titles", "philosophy" ],
"values" : [ "1", "4" ]
}
}
The type is
optional and can be omitted, and can also accept an array of values.
Subscribe to:
Posts (Atom)