public class QueryToElasticsearch extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addRoots(org.elasticsearch.index.query.BoolQueryBuilder query,
String field,
Collection<String> roots,
int depth) |
static org.elasticsearch.index.query.QueryBuilder |
getCommand(Query query) |
static List<org.elasticsearch.search.aggregations.AggregationBuilder> |
getFacets(AbstractParser<?> requestParser)
Create ES facets from request parser
|
static org.elasticsearch.index.query.QueryBuilder |
getFullCommand(org.elasticsearch.index.query.QueryBuilder command,
org.elasticsearch.index.query.QueryBuilder roots)
Merge a request and a root filter
|
static org.elasticsearch.index.query.QueryBuilder |
getRoots(String field,
Collection<String> roots) |
static List<org.elasticsearch.search.sort.SortBuilder> |
getSorts(AbstractParser<?> requestParser,
boolean hasFullText,
boolean score)
Generate sort list from order by ES query orders : {field1 : -1, field2 : 1} or [{field1 : -1, field2 :
1},{field3 : -1}]
Note : if the query contains a match and the collection allows to use score, the socre is added to the sort |
public static org.elasticsearch.index.query.QueryBuilder getRoots(String field, Collection<String> roots)
field
- Stringroots
- Set of Stringpublic static void addRoots(org.elasticsearch.index.query.BoolQueryBuilder query, String field, Collection<String> roots, int depth)
query
- field
- Stringroots
- Set of Stringpublic static org.elasticsearch.index.query.QueryBuilder getFullCommand(org.elasticsearch.index.query.QueryBuilder command, org.elasticsearch.index.query.QueryBuilder roots)
command
- QueryBuilderroots
- QueryBuilderpublic static List<org.elasticsearch.search.sort.SortBuilder> getSorts(AbstractParser<?> requestParser, boolean hasFullText, boolean score) throws InvalidParseOperationException
requestParser
- the original parserhasFullText
- True to add scoreSortscore
- True will add score firstInvalidParseOperationException
- if the orderBy is not validpublic static org.elasticsearch.index.query.QueryBuilder getCommand(Query query) throws InvalidParseOperationException
query
- QueryInvalidParseOperationException
- if query could not parse to commandpublic static List<org.elasticsearch.search.aggregations.AggregationBuilder> getFacets(AbstractParser<?> requestParser) throws InvalidParseOperationException
requestParser
- parserInvalidParseOperationException
- if could not create ES facetsCopyright © 2018 Vitam. All rights reserved.