Class QueryToElasticsearch
java.lang.Object
fr.gouv.vitam.common.database.translators.elasticsearch.QueryToElasticsearch
Elasticsearch Translator
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addRoots
(co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery.Builder query, String field, Collection<String> roots, int depth) static co.elastic.clients.elasticsearch._types.query_dsl.Query
getCommand
(Query query, VarNameAdapter adapter, DynamicParserTokens parserTokens) getFacets
(AbstractParser<?> requestParser, DynamicParserTokens parserTokens) Create ES facets from request parserstatic co.elastic.clients.elasticsearch._types.query_dsl.Query
getFullCommand
(co.elastic.clients.elasticsearch._types.query_dsl.Query command, co.elastic.clients.elasticsearch._types.query_dsl.Query roots) Merge a request and a root filterstatic co.elastic.clients.elasticsearch._types.query_dsl.Query
getRoots
(String field, Collection<String> roots) static List<co.elastic.clients.elasticsearch._types.SortOptions>
getSorts
(AbstractParser<?> requestParser, boolean score, DynamicParserTokens parserTokens) 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
-
Method Details
-
getRoots
public static co.elastic.clients.elasticsearch._types.query_dsl.Query getRoots(String field, Collection<String> roots) - Parameters:
field
- Stringroots
- Set of String- Returns:
- the filter associated with the roots
-
addRoots
public static void addRoots(co.elastic.clients.elasticsearch._types.query_dsl.BoolQuery.Builder query, String field, Collection<String> roots, int depth) - Parameters:
query
-field
- Stringroots
- Set of String
-
getFullCommand
public static co.elastic.clients.elasticsearch._types.query_dsl.Query getFullCommand(co.elastic.clients.elasticsearch._types.query_dsl.Query command, co.elastic.clients.elasticsearch._types.query_dsl.Query roots) Merge a request and a root filter- Parameters:
command
- QueryBuilderroots
- QueryBuilder- Returns:
- the complete request
-
getSorts
public static List<co.elastic.clients.elasticsearch._types.SortOptions> getSorts(AbstractParser<?> requestParser, boolean score, DynamicParserTokens parserTokens) 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
- Parameters:
requestParser
- the original parserscore
- True will add score firstparserTokens
-- Returns:
- list of order by as sort objects
-
getCommand
public static co.elastic.clients.elasticsearch._types.query_dsl.Query getCommand(Query query, VarNameAdapter adapter, DynamicParserTokens parserTokens) throws InvalidParseOperationException - Parameters:
query
- QueryparserTokens
-- Returns:
- the associated QueryBuilder
- Throws:
InvalidParseOperationException
- if query could not parse to command
-
getFacets
public static Map<String,co.elastic.clients.elasticsearch._types.aggregations.Aggregation> getFacets(AbstractParser<?> requestParser, DynamicParserTokens parserTokens) throws InvalidParseOperationException Create ES facets from request parser- Parameters:
requestParser
- parser- Returns:
- list of facets
- Throws:
InvalidParseOperationException
- if could not create ES facets
-