Urban rail data query method, device, electronic device and readable storage medium
By using the Elasticsearch cluster database and DSL/SQL query method in urban rail data query, the problem of low efficiency and insufficient reliability of traditional databases in processing massive data is solved, and efficient storage and fast query of urban rail big data are achieved.
Patent Information
- Application Number
- CN202110791929.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-13
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2041-07-13
AI Technical Summary
When traditional relational databases process massive urban rail data at PB or TB levels, they have problems such as low task processing efficiency, error-prone and low reliability, making it difficult to achieve real-time retrieval.
Using the Elasticsearch cluster database combined with DSL and SQL query methods, by judging the form of the query request, selecting appropriate query expressions for query, and utilizing Elasticsearch's distributed architecture and powerful near-real-time retrieval capabilities to achieve efficient storage and fast query.
It effectively breaks through the limitation of data scale, realizes efficient storage and near-real-time fast query of urban rail big data, and improves task processing efficiency and reliability.
Smart Images

Figure CN113688148B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rail transit data technology, and in particular to an urban rail transit data query method, device, electronic equipment and readable storage medium. Background Art
[0002] Traditional databases such as MySQL, Oracle and other relational databases have a wide range of applications and are very suitable for the storage and query of structured data. In the data query scenario, the system returns all records that meet the matching conditions by default.
[0003] However, with the rapid development of urban rail big data, more and more data is stored. Traditional relational databases are difficult to solve the storage and real-time retrieval of massive data at the PB level or even the TB level. Summary of the invention
[0004] The present invention provides a method, device, electronic device and readable storage medium for querying urban rail data, which are used to solve the defects of the prior art such as low task processing efficiency, easy error and low reliability, and achieve the goal of effectively improving task processing efficiency and reliability.
[0005] The present invention provides a method for querying urban rail data, comprising:
[0006] Obtain a user's query request, and by determining the query form of the query request, use a SQL query expression or a DSL query expression to query a preset Elasticsearch cluster database to obtain target urban rail data corresponding to the query request;
[0007] Among them, the preset Elasticsearch cluster database stores urban rail train big data in a distributed manner.
[0008] According to a method for querying urban rail data provided by the present invention, the query form of the query request application is judged, and a SQL query expression or a DSL query expression is used to query a preset Elasticsearch cluster database, including:
[0009] Determine whether the query form of the query request application meets the DSL expression standard. If so, after the query form passes the integrity check, use the DSL query expression to query the preset Elasticsearch cluster database;
[0010] If the query form does not meet the DSL expression standard, after the query form passes the integrity check, the SQL query expression is used to query the preset Elasticsearch cluster database.
[0011] According to a method for querying urban rail data provided by the present invention, the SQL query expression is used to query the preset Elasticsearch cluster database, including:
[0012] According to the form of the key corresponding to the query form of the query request application, the type of the SQL query expression corresponding to the query form is determined; if the type is the first preset type, X-PACK SQL is used to query the preset Elasticsearch cluster database; if the type is the second preset type, the SQL query expansion tool provided by Open Distro for Elasticsearch is used to query the preset Elasticsearch cluster database.
[0013] A method for querying urban rail data provided by the present invention further includes:
[0014] Configure request rules for data query requests, the request rules include:
[0015] Use json format to implement data query requests through DSL query expressions;
[0016] Use any of SELECT, WHERE, LIMIT, ORDER BY, GROUP BY, and COUNT, or any of join and leftjoin to implement data query requests through SQL query expressions.
[0017] A method for querying urban rail data provided by the present invention further includes:
[0018] On multiple data platforms storing the urban rail train big data, the preset Elasticsearch cluster database including at least one Master node and multiple Data nodes is deployed, and the Opendistro_sql plug-in is installed in the Elasticsearch cluster environment to support users to perform data queries through the query requests.
[0019] A method for querying urban rail data provided by the present invention further includes:
[0020] The target urban rail data is sent to the user terminal in the form of JSON.
[0021] The present invention also provides a city rail data query device, comprising:
[0022] A query module is used to obtain a user's query request, and by determining the query form of the query request, use a SQL query expression or a DSL query expression to query a preset Elasticsearch cluster database to obtain target urban rail data corresponding to the query request;
[0023] Among them, the preset Elasticsearch cluster database stores urban rail train big data in a distributed manner.
[0024] According to a city rail data query device provided by the present invention, the query module, when used to query a preset Elasticsearch cluster database by judging the query form of the query request application, corresponds to using an SQL query expression or a DSL query expression, is used to:
[0025] Determine whether the query form of the query request application meets the DSL expression standard. If so, after the query form passes the integrity check, use the DSL query expression to query the preset Elasticsearch cluster database;
[0026] If the query form does not meet the DSL expression standard, after the query form passes the integrity check, the SQL query expression is used to query the preset Elasticsearch cluster database.
[0027] The present invention also provides an electronic device, comprising a memory, a processor, and a program or instruction stored in the memory and executable on the processor. When the processor executes the program or instruction, the steps of the urban rail data query method described in any one of the above are implemented.
[0028] The present invention also provides a non-transitory computer-readable storage medium on which a program or instruction is stored. When the program or instruction is executed by a computer, the steps of the urban rail data query method as described in any one of the above are implemented.
[0029] The urban rail data query method, device, electronic device and readable storage medium provided by the present invention, by adopting the Elasticsearch cluster database and combining the DSL and SQL query mode, can make good use of the friendly RESTful interface and powerful near-real-time fast retrieval and efficient storage capabilities in the distributed architecture of Elasticsearch, as well as the powerful ability of the DSL query language to process complex nested queries, thereby effectively breaking through the limitation of data scale and realizing efficient storage and near-real-time fast query of urban rail big data. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments of the present invention or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 One of the flow charts of the urban rail data query method provided by the present invention;
[0032] Figure 2 The second flowchart of the urban rail data query method provided by the present invention;
[0033] Figure 3 The third flowchart of the urban rail data query method provided by the present invention;
[0034] Figure 4 An example diagram showing a query result set in the urban rail data query method provided by the present invention;
[0035] Figure 5 A schematic diagram of the structure of the urban rail data query device provided by the present invention;
[0036] Figure 6 A schematic diagram of the physical structure of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] The present invention aims to solve the problems of low task processing efficiency, easy errors and low reliability in the prior art. By adopting the Elasticsearch cluster database and combining the query method of DSL and SQL, the present invention can effectively break through the limitation of data scale and realize efficient storage and near real-time fast query of urban rail big data. The present invention will be described and introduced in detail through multiple embodiments in conjunction with the accompanying drawings.
[0039] Figure 1 This is one of the flow charts of the urban rail data query method provided by the present invention, such as Figure 1 As shown, the method includes:
[0040] S101, obtaining a user's query request, and by determining the query form of the query request, using a SQL query expression or a DSL query expression to query a preset Elasticsearch cluster database, and obtaining target urban rail data corresponding to the query request.
[0041] Among them, the preset Elasticsearch cluster database stores urban rail train big data in a distributed manner.
[0042] It can be understood that when a user needs to retrieve or query the desired target urban rail data based on urban rail big data, a query request can be sent to the server through a user terminal or an operating platform according to relevant rules. It should be understood that the query request must contain relevant information pointing to the target urban rail data, and the query form (or query expression) adopted by it must comply with the provisions of the above-mentioned relevant rules. Among them, the above-mentioned relevant rules can be the rules that the present invention pre-configured to generate query requests to be followed.
[0043] Optionally, the urban rail data query method further includes: configuring a request rule for a data query request, the request rule including: using a json format to implement a data query request through a DSL query expression; using any one of SELECT, WHERE, LIMIT, ORDER BY, GROUP BY and COUNT or any one of join and left join to implement a data query request through an SQL query expression.
[0044] It can be understood that the present invention can configure the request rules for generating query requests for the user in advance (through the user terminal or operating platform, etc.), including the request rules configured for the DSL query mode or the SQL query mode respectively. On this basis, the user can query the data using the DSL query mode or the SQL query mode through the configured request rules.
[0045] Among them, for the DSL query method, use DSL query expressions to query data. The query format is json, and the standard "DSL" syntax can be used directly for query.
[0046] Writing example:
[0047]
[0048] With respect to the SQL query mode, the present invention configures two SQL query modes, namely, "basic SQL" expression and "complex SQL" expression.
[0049] Among them, the basic SQL query expression provides single-index-based query functions such as SELECT, WHERE, LIMIT, ORDER BY, GROUP BY, and COUNT. The basic SQL expression is written as: {"query_sql":"sql expression"}.
[0050] Writing example:
[0051] {
[0052] "query_sql":"select count(*)from 9007948"
[0053] }
[0054] Complex SQL expressions provide join and left join query functions based on multiple associated indexes. Complex SQL expressions are written as: {"query_sql_join":"sql expression"}.
[0055] Writing example:
[0056] {
[0057] "query_sql_join":"select switch_name from 9007948c join 9007962h onc.switch_name=h.switch_name limit 2"
[0058] }
[0059] The present invention pre-configures request rules based on DSL query expressions and request rules based on SQL query expressions, and can quickly match the most reasonable query method after receiving a user's query request, thereby further improving data query efficiency.
[0060] After the user sends a query request through the user terminal or the operating platform, the server of the present invention can obtain the query request. After that, by parsing the query request, the form of the query expression contained therein, that is, the query form, is determined, and then a specific query form is adopted, and according to the relevant information pointing to the target urban rail data, a SQL query expression is used to query the preset Elasticsearch cluster database, or a DSL query expression is used to query the preset Elasticsearch cluster database, and finally the desired target urban rail data is obtained.
[0061] The urban rail data query method provided by the present invention, by adopting the Elasticsearch cluster database and combining the DSL combined with SQL query mode, can make good use of the friendly RESTful interface and powerful near real-time fast retrieval and efficient storage capabilities in the distributed architecture of Elasticsearch, as well as the powerful ability of the DSL query language to process complex nested queries, thereby effectively breaking through the limitation of data scale and realizing efficient storage and near real-time fast query of urban rail big data.
[0062] It can be understood that the Elasticsearch cluster database of the above-mentioned embodiments is pre-established, and stores therein relevant software and hardware information of the urban rail or urban rail equipment and big data information of the operation process.
[0063] Optionally, pre-establishing an Elasticsearch cluster database includes: deploying the preset Elasticsearch cluster database including at least one Master node and multiple Data nodes on multiple data platforms storing the urban rail train big data, and installing an Opendistro_sql plug-in in the Elasticsearch cluster environment to support users to perform data queries through the query requests.
[0064] It can be understood that, Figure 2 As shown, it is the second flow diagram of the urban rail data query method provided by the present invention, wherein before querying the target urban rail data according to the query request provided by the user, it also includes the processing steps of Elasticsearch cluster deployment and Opendistro_sql plug-in installation. On the basis of installing the Opendistro_sql plug-in, the front end makes a query request according to the provided request rules, the server determines the query method to be used according to the request, verifies the query expression, and obtains the query result. This query process is an efficient query and joint query based on Elasticsearch for urban rail big data.
[0065] Specifically, when deploying an Elasticsearch cluster, the Elasticsearch cluster usually deploys multiple Master nodes and several Data nodes. The main function of the Master node is to maintain metadata and manage the status of cluster nodes, and is not responsible for data writing and querying. The main function of the Data node is to be responsible for data writing and querying. The Master node and Data node can be existing devices or servers for storing and managing urban rail big data, or they can be newly set up or arranged nodes for storing or managing urban rail big data.
[0066] When installing the Opendistro_sql plug-in, put the Opendistro_sql plug-in installation package opendistro_sql-0.7.0.0.zip into the plugin directory in the Elasticsearch installation directory, and execute the bin / elasticsearch-plugin install opendistro_sql-0.7.0.0.zip command to install the Opendistro_sql plug-in.
[0067] The present invention can improve the parallel processing capability of the Elasticsearch cluster database by deploying a preset Elasticsearch cluster database including at least one Master node and multiple Data nodes on multiple data platforms storing urban rail train big data, and can increase the reliability of the database while improving data query efficiency.
[0068] Among them, according to the urban rail data query method provided by the above embodiments, optionally, the query form of the query request application is judged, and a SQL query expression or a DSL query expression is used correspondingly to query the preset Elasticsearch cluster database, including: judging whether the query form of the query request application meets the DSL expression standard, and if so, after the query form is checked for integrity, the DSL query expression is used to query the preset Elasticsearch cluster database; if the query form does not meet the DSL expression standard, after the query form is checked for integrity, the SQL query expression is used to query the preset Elasticsearch cluster database.
[0069] It can be understood that, Figure 3 As shown, it is the third flow diagram of the urban rail data query method provided by the present invention. After obtaining the query request of the user, the query form applied to the query request is judged, that is, whether the query form applied to the query request meets the DSL expression standard, that is, whether the expression in json meets the DSL expression standard. If it meets the standard, the DSL expression is basically verified to ensure the integrity of the expression, and the DSL query expression is used to query the data. If it does not meet the standard, the SQL expression is verified to ensure the integrity of the expression, and the SQL query expression is tried to perform the query operation.
[0070] The present invention attempts to use SQL query expressions to perform query operations when it is determined that the query form of the user's query request does not conform to the DSL expression, which can effectively utilize the advantages of SQL query language syntax being concise and easy to write, and reduce the workload of staff. At the same time, both the DSL expression and the SQL expression based on the query request need to be verified before the query operation, which can ensure the integrity of the expression and avoid errors.
[0071] Among them, according to the urban rail data query method provided by the above embodiments, optionally, the use of SQL query expression to query the preset Elasticsearch cluster database includes: judging the type of SQL query expression corresponding to the query form according to the form of the key corresponding to the query form applied by the query request; if the type is the first preset type, using X-PACK SQL to query the preset Elasticsearch cluster database; if the type is the second preset type, using the SQL query expansion tool provided by Open Distro for Elasticsearch to query the preset Elasticsearch cluster database.
[0072] It can be understood that, Figure 3 As shown, when it is determined to use SQL query expression to query urban rail data, the present invention can judge the SQL expression according to the key corresponding to the SQL expression. If it is basic SQL, that is, it belongs to the first preset type, X-PACK SQL will be used for query operation. Because X-PACK SQL is a standard SQL query tool provided by Elasticsearch, it is better optimized and faster in query speed when applied in Elasticsearch.
[0073] If the SQL expression is complex SQL, that is, it belongs to the second preset type, the SQL query expansion tool provided by Open Distro for Elasticsearch will be used for query. Because Open Distro for Elasticsearch can provide better support for multi-association index queries, the query accuracy is higher.
[0074] Among them, according to the urban rail data query method provided by the above embodiments, optionally, the urban rail data query method also includes: sending the target urban rail data to the user terminal in the form of json.
[0075] It can be understood that after obtaining the query result set (i.e., the target urban rail data), the present invention will return the query result set to the front-end user in the form of an array. Specifically, after obtaining the data query result set, it will be converted into an array and returned to the user in the form of json, for example, it can be sent to the user's user terminal or displayed on a display unit pushed to the operating platform. Among them, the query result set returned to the user includes an indicator of whether the query is successful and a specific target urban rail data set.
[0076] like Figure 4 As shown in the figure, it is an example diagram showing the query result set in the urban rail data query method provided by the present invention, wherein code indicates whether the query is successful, and 200 indicates successful acquisition. data indicates the specific target urban rail data set. data is presented in the form of an array, and the specific content of each data that meets the query condition is presented in the form of json in the array.
[0077] The present invention returns the query result to the user in the form of JSON, which can fully utilize the lighter and more friendly characteristics of JSON, so that the user can read the query result content more easily and it is more convenient for the user to check errors with the naked eye.
[0078] Based on the same inventive concept, the present invention further provides a city rail data query device according to the above embodiments, and the device is used to implement the city rail data query in the above embodiments. Therefore, the description and definition in the city rail data query method in the above embodiments can be used for understanding each execution module in the present invention, and the details can be referred to the above method embodiments, which will not be repeated here.
[0079] According to one embodiment of the present invention, the structure of the urban rail data query device is as follows: Figure 5 FIG. 1 is a schematic diagram of the structure of the urban rail data query device provided by the present invention. The device can be used to implement the urban rail data query in the above-mentioned method embodiments. The device includes:
[0080] The query module 501 is used to obtain a user's query request, and by determining the query form of the query request, use a SQL query expression or a DSL query expression to query a preset Elasticsearch cluster database to obtain target urban rail data corresponding to the query request;
[0081] Among them, the preset Elasticsearch cluster database stores urban rail train big data in a distributed manner.
[0082] The urban rail data query device provided by the present invention, by adopting the Elasticsearch cluster database and combining the DSL and SQL query method, can make good use of the friendly RESTful interface and powerful near real-time fast retrieval and efficient storage capabilities in the distributed architecture of Elasticsearch, as well as the powerful ability of the DSL query language to process complex nested queries, thereby effectively breaking through the limitation of data scale and realizing efficient storage and near real-time fast query of urban rail big data.
[0083] Optionally, the query module, when used to determine the query form of the query request application, corresponds to using a SQL query expression or a DSL query expression to query a preset Elasticsearch cluster database, is used to:
[0084] Determine whether the query form of the query request application meets the DSL expression standard. If so, after the query form passes the integrity check, use the DSL query expression to query the preset Elasticsearch cluster database;
[0085] If the query form does not meet the DSL expression standard, after the query form passes the integrity check, the SQL query expression is used to query the preset Elasticsearch cluster database.
[0086] Optionally, the query module, when used to query the preset Elasticsearch cluster database using the SQL query expression, is used to:
[0087] According to the form of the key corresponding to the query form of the query request application, the type of the SQL query expression corresponding to the query form is determined; if the type is the first preset type, X-PACK SQL is used to query the preset Elasticsearch cluster database; if the type is the second preset type, the SQL query expansion tool provided by Open Distro for Elasticsearch is used to query the preset Elasticsearch cluster database.
[0088] Furthermore, the urban rail data query device of the present invention further includes a configuration module, which is used to:
[0089] Configure request rules for data query requests, the request rules include:
[0090] Use json format to implement data query requests through DSL query expressions;
[0091] Use any of SELECT, WHERE, LIMIT, ORDER BY, GROUP BY, and COUNT, or any of join and leftjoin to implement data query requests through SQL query expressions.
[0092] Furthermore, the urban rail data query device of the present invention also includes a database deployment module, which is used to: deploy the preset Elasticsearch cluster database including at least one Master node and multiple Data nodes on multiple data platforms storing the urban rail train big data, and install the Opendistro_sql plug-in in the Elasticsearch cluster environment to support users to perform data queries through the query requests.
[0093] Furthermore, the urban rail data query device of the present invention further includes a sending module, which is used to:
[0094] The target urban rail data is sent to the user terminal in the form of JSON.
[0095] It is understandable that the present invention can implement the relevant program modules in the devices of the above embodiments by means of a hardware processor. Moreover, the urban rail data query device of the present invention utilizes the above program modules to implement the urban rail data query process of the above method embodiments. When used to implement the urban rail data query in the above method embodiments, the beneficial effects produced by the device of the present invention are the same as those of the corresponding above method embodiments, and the above method embodiments can be referred to, and will not be repeated here.
[0096] As another aspect of the present invention, this embodiment provides an electronic device according to the above embodiments, and the electronic device includes a memory, a processor, and a program or instruction stored in the memory and executable on the processor. When the processor executes the program or instruction, the steps of the urban rail data query method described in the above embodiments are implemented.
[0097] Furthermore, the electronic device of the present invention may also include a communication interface and a bus. Figure 6 , which is a schematic diagram of the physical structure of the electronic device provided by the present invention, includes: at least one memory 601, at least one processor 602, a communication interface 603 and a bus 604.
[0098] Among them, the memory 601, the processor 602 and the communication interface 603 complete mutual communication through the bus 604, and the communication interface 603 is used for information transmission between the electronic device and the urban rail big data device; the memory 601 stores a program or instruction that can be run on the processor 602. When the processor 602 executes the program or instruction, the steps of the urban rail data query method described in the above embodiments are implemented.
[0099] It can be understood that the electronic device at least includes a memory 601, a processor 602, a communication interface 603 and a bus 604, and the memory 601, the processor 602 and the communication interface 603 form a communication connection with each other through the bus 604, and can complete mutual communication, such as the processor 602 reading the program instructions of the urban rail data query method from the memory 601. In addition, the communication interface 603 can also realize the communication connection between the electronic device and the urban rail big data device, and can complete the information transmission between them, such as realizing the reading of urban rail big data through the communication interface 603.
[0100] When the electronic device is running, the processor 602 calls the program instructions in the memory 601 to execute the methods provided by the above-mentioned method embodiments, for example, including: obtaining a user's query request, and by determining the query form of the query request application, correspondingly using an SQL query expression or a DSL query expression, querying a preset Elasticsearch cluster database, and obtaining target urban rail data corresponding to the query request, etc.
[0101] The program instructions in the above-mentioned memory 601 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Alternatively, all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions, and the above-mentioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the above-mentioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (RandomAccess Memory, RAM), disk or optical disk and other media that can store program codes.
[0102] The present invention also provides a non-transitory computer-readable storage medium according to the above embodiments, on which a program or instruction is stored. When the program or instruction is executed by a computer, the steps of the urban rail data query method described in the above embodiments are implemented, for example, including: obtaining a user's query request, and by judging the query form applied to the query request, correspondingly using an SQL query expression or a DSL query expression, querying a preset Elasticsearch cluster database, and obtaining the target urban rail data corresponding to the query request, etc.
[0103] As another aspect of the present invention, this embodiment further provides a computer program product according to the above embodiments, wherein the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the urban rail data query method provided by the above method embodiments, and the method includes, for example: obtaining a user's query request, and by determining the query form of the query request, correspondingly using an SQL query expression or a DSL query expression, querying a preset Elasticsearch cluster database, and obtaining the target urban rail data corresponding to the query request.
[0104] The electronic device, non-transitory computer-readable storage medium, and computer program product provided by the present invention, by executing the steps of the urban rail data query method described in the above embodiments, adopting the Elasticsearch cluster database, and combining the DSL and SQL query method, can make good use of the friendly RESTful interface and powerful near-real-time fast retrieval and efficient storage capabilities in the distributed architecture of Elasticsearch, as well as the powerful ability of the DSL query language to process complex nested queries, thereby effectively breaking through the limitation of data scale and realizing efficient storage and near-real-time fast query of urban rail big data.
[0105] It is understandable that the embodiments of the apparatus, electronic device, and storage medium described above are merely illustrative, and the units described as separate components may or may not be physically separated, and may be located in one place, or may be distributed on different network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0106] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk or an optical disk, etc., including a number of instructions to enable a computer device (such as a personal computer, a server, or a network device, etc.) to execute the methods described in the above method embodiments or some parts of the method embodiments.
[0107] In addition, it should be understood by those skilled in the art that, in the application documents of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0108] In the specification of the present invention, a large number of specific details are described. However, it should be understood that embodiments of the present invention can be practiced without these specific details. In some examples, known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this specification. Similarly, it should be understood that in order to simplify the disclosure of the present invention and help understand one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure or description thereof.
[0109] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for querying urban rail data, characterized in that: include: Obtaining a query request from a user, and determining a query form included in the query request, wherein the query form is a query expression form; If the query form meets the DSL expression standard, after the query form passes the integrity check, the DSL query expression is used to query the preset Elasticsearch cluster database to obtain the target urban rail data corresponding to the query request; If the query form does not meet the DSL expression standard, after the query form passes the integrity check, the SQL query expression is used to query the preset Elasticsearch cluster database to obtain the target urban rail data corresponding to the query request; Among them, the preset Elasticsearch cluster database stores urban rail train big data in a distributed manner.
2. The urban rail data query method according to claim 1, characterized in that: The SQL query expression is used to query the preset Elasticsearch cluster database, including: According to the form of the key corresponding to the query form contained in the query request, the type of the SQL query expression corresponding to the query form is determined; if the type is the first preset type, X-PACK SQL is used to query the preset Elasticsearch cluster database; if the type is the second preset type, the SQL query expansion tool provided by Open Distro for Elasticsearch is used to query the preset Elasticsearch cluster database.
3. The urban rail data query method according to claim 1 or 2, characterized in that: Also includes: Configure request rules for data query requests, the request rules include: Use json format to implement data query requests through DSL query expressions; Use any of the formats of SELECT, WHERE, LIMIT, ORDER BY, GROUP BY, and COUNT, or any of the formats of join and left join to implement data query requests through SQL query expressions.
4. The urban rail data query method according to claim 1, characterized in that: Also includes: On multiple data platforms storing the urban rail train big data, the preset Elasticsearch cluster database including at least one Master node and multiple Data nodes is deployed, and the Opendistro_sql plug-in is installed in the Elasticsearch cluster environment to support users to perform data queries through the query requests.
5. The urban rail data query method according to claim 1, characterized in that: Also includes: The target urban rail data is sent to the user terminal in the form of JSON.
6. A urban rail data query device, characterized in that: include: A query module, used to obtain a query request from a user and determine a query form contained in the query request, where the query form is a query expression; If the query form meets the DSL expression standard, after the query form passes the integrity check, the DSL query expression is used to query the preset Elasticsearch cluster database to obtain the target urban rail data corresponding to the query request; If the query form does not meet the DSL expression standard, after the query form passes the integrity check, the SQL query expression is used to query the preset Elasticsearch cluster database to obtain the target urban rail data corresponding to the query request; Among them, the preset Elasticsearch cluster database stores urban rail train big data in a distributed manner.
7. An electronic device comprising a memory, a processor, and a program or instruction stored in the memory and executable on the processor, characterized in that: When the processor executes the program or instruction, the steps of the urban rail data query method according to any one of claims 1 to 5 are implemented.
8. A non-transitory computer-readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a computer, the steps of the urban rail data query method according to any one of claims 1 to 5 are implemented.
