dqt — DEPAROM Query Translator
The service is primarily tailored for our DEPAROM Profil customers and anyone else who wants to use queries in the DEPAROM query language to search the DEPAROM index. It provides a RESTful interface to receive DEPAROM queries and returns a matching Elasticsearch query to be used on the DEPAROM index.
Information Required
In order to use the DEPAROM Query Translator you will need a DEPAROM Query to translate. You can get one from your latest DEPAROM volume. Alternatively you can write your own based on the below examples and the documentation of the DEPAROM Recherche Client which is available for download.
Tutorial
In order to send data to the HTTP API you need some form of REST client. This can be a basic tool like cURL, a fully featured REST client like Insomnia or any client library targeted for your development language. For this tutorial we will assume cURL and provide examples as cURL commands, since it is a widely available tool on most operating systems. We want to send a DEPAROM query to the service, so that we can get a translated query back which we can then use, to query the Elasticsearch index. We also need to authenticate against the proxy with our credential using http simple authentication. A cURL command would look like the following:
cURL Command Example
This will result in a response which carries the query object in JSON format, ready to be inserted in an Elasticsearch query. The returned output should look like this:
response example
If you are familiar with Elasticsearch queries you will notice, that the payload does not resemble a proper Elasticsearch query. This is on purpose. The returned JSON object is to be used as an inner query object either by embedding it in the root query object or as part of a larger query like a bool query. The most simple approach would look like this:
embedded JSON object example
As you see, the result JSON is set as the “query” key in the Elasticsearch root query object. For more details on how to query the DEPAROM index, please refer to the Elasticsearch index section of this documentation.
Known Issues
Quotation marks around values
At the moment you are encouraged to put any text value which has a length of 2 characters or less in quotation marks like so: PC=“DE”. Currently there is a problem with the parser which confuses values which are equal to field names for field names, resulting in an error.
Truncations with asterisk
Truncation currently only work in the KI field, due to a bug in the translator.
API Documentation
Translate Query
BASE URL | https://api.depa.tech |
Endpoint | /dqt/query/es |
Method | POST |
Notes | Send a query in DEPAROM format in the request body and get a query Elasticsearch format returned. |
Usage Example:
translate query example
Back to Manuals