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.


BSearch-QueryBuilder has the following features:
  • 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.

Elasticsearch provides a complete JSON query DSL for you to define queries. QueryDSL provides various query expressions. Some queries can wrap other queries, such as the boolean queries. Some queries can wrap filters, such as the constant score queries. Some queries can wrap other queries and filters at the same time, such as the filtered queries. You can use any query expressions and filters supported by Elasticsearch to create complex queries and filter the returned result. DSL is only mastered by a few programmers. You may make mistakes when writing DSL statements. QueryBuilder can help users that do not have much knowledge in Elasticsearch DSL or those that want to create DSL queries efficiently.


To use the BSearch-QueryBuilder plug-in, you must first purchase an Elasticsearch instance. The version of the instance must be 6.3 or 6.7. Version 5.5.3 is not supported.

Note You can also use an existing instance. If the instance version does not meet the requirements, upgrade the instance.

Install the BSearch-QueryBuilder plug-in

Notice Before you install the BSearch-QueryBuilder plug-in, make sure that the specification of your Kibana node is 2-core, 4 GB or higher. Otherwise, Cluster upgrade.
  1. Log on to the Alibaba Cloud Elasticsearch console.
  2. Click the name of the Elasticsearch instance, and then click Data Visualization in the left-side navigation pane.
  3. On the Data Visualization page, click Edit Configuration under Kibana.

  4. 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.
  5. 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

  1. Go back to the Data Visualization page, click Console under Kibana.
  2. 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.

  3. In the Kibana console, select Discover > Query.
    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 Index Patterns > Create index pattern.
  4. 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.


The BSearch-QueryBuilder plug-in allows you to create a variety of queries, such as regexp queries, boolean queries, and range queries.
  • 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 days are returned.

    The following figure shows the returned result.

With all these search conditions and filters, you can define a complex query as follows:

The actual DSL statement for the query is as follows:

As shown in the preceding examples, BSearch-QueryBuilder significantly simplifies the complexity of Elasticsearch queries.