BSearch-QueryBuilder is an advanced query plug-in, as well as a UI component. With the BSearch-QueryBuilder plug-in, you no longer need to write complex DSL statements for data query. It allows you to create complex queries in a visualized manner. This document describes how to use the BSearch-QueryBuilder plug-in to create a query.
- Easy to learn: the BSearch-QueryBuilder plug-in is a UI component, allowing you to create Elasticsearch DSL queries in a visualized manner. You can customize search conditions without coding. This saves the costs of learning complex DSL statements. It also helps developers write and verify DSL statements.
- Easy to use: all queries that you have defined are saved in Kibana, which are ready for use at anytime.
- Compact: BSearch-QueryBuilder only consumes about 14 MB of disk space. BSearch-QueryBuilder does not stay resident in the memory. This means that it will not adversely affect the performance of Kibana and Elasticsearch.
- Secure and reliable: BSearch-QueryBuilder does not rewrite, store, or forward any user data. The source code of BSearch-QueryBuilder has been verified by Alibaba Cloud security auditing.
QueryDSL is an open-source Java framework used to define SQL type-safe queries. It allows you to use API operations to send queries instead of writing statements. Currently, QueryDSL supports JPA, JDO, SQL, Java Collections, RDF, Lucene, and Hibernate Search.
Install the BSearch-QueryBuilder plug-in
- Log on to the Alibaba Cloud Elasticsearch console.
- Click the name of the Elasticsearch instance, and then click Data Visualization in the left-side navigation pane.
- On the Data Visualization page, click Edit Configuration under Kibana.
- On the Kibana Configuration page, click Install on the right side of Bsearch_querybuilder in the Plug-in Configuration list.
Notice After you confirm the install operation, the system will restart the Kibana node. Therefore, before you confirm the operation, you must make sure that the restart process does not affect your operations on the Kibana console.
- Confirm the operation and restart the Kibana node.
After the Kibana node is restarted, the installation process is then completed. The plug-in will be in the Installed state.
Note The installation process may be time-consuming.
Use the BSearch-QueryBuilder plug-in
- Go back to the Data Visualization page, click Console under Kibana.
- Enter the username and password, and then click LOG IN to log on to the Kibana console.
The default username is elastic. Enter the password that you have set when purchasing the Elasticsearch instance.
- In the Kibana console, select Notice Before querying, make sure that you have created an index pattern. To create an index pattern, in the Kibana console, click Management, find the Kibanaarea, and click .
- In the query area, select a search condition and filter, and click Submit.
After you submit the query, the system shows the query result.
In the query area, click the icon to add a search condition, click the icon to add a filter for the condition, or click the icon to delete a search condition or filter.
For more information, see Examples.
- Regexp queries
As shown in the following figure, the email condition is added for fuzzy match. The email condition matches all email addresses that contain the iga keyword.The following figure shows the returned result:
- Boolean queries
As shown in the following figure, the index condition is set to tryme_book. An OR condition containing multiple filters is also added to filter data by type. These type filters are set to Undergraduate teaching materials, Math, Foreign language teaching, and Undergraduate textbooks.The following figure shows the returned result.
- Range queries
Range queries allow you to search data by date. As shown in the following figure, the range condition is used to filter data based on the utc_time field. Only data entries created
in the last 240 daysare returned.The following figure shows the returned result.
As shown in the preceding examples, BSearch-QueryBuilder significantly simplifies the complexity of Elasticsearch queries.