public class QueryToElasticsearch extends Object
Modifier and Type | Method and Description |
---|---|
static org.elasticsearch.index.query.QueryBuilder |
getCommand(Query query) |
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) throws InvalidParseOperationException
field
- Stringroots
- Set of StringInvalidParseOperationException
- if field is not in rootspublic 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 commandCopyright © 2018 Vitam. All rights reserved.