Business data query method, device, server and storage medium

By setting the business data of different data classification conditions in ES and only corresponding to one data shard, the problem of low efficiency of business data query in the prior art is solved, and more efficient data query and storage is achieved.

CN112181993BActive Publication Date: 2025-02-18GUANGZHOU NETSTAR INFORMATION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011168056.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-27
Publication Date
2025-02-18
Estimated Expiration
2040-10-27

AI Technical Summary

Technical Problem

The prior art requires querying and filtering all indexes in business data query, resulting in reduced query efficiency.

Method used

By setting each index in ES to store business data with different data classification conditions and only correspond to one data shard, the target index is filtered out from multiple indexes according to the data query conditions, thereby reducing useless query operations.

Benefits of technology

It improves data query efficiency, reduces the server's query process and data storage volume, and avoids broadcast queries and comprehensive query results of multiple data shards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112181993B_ABST
    Figure CN112181993B_ABST
Patent Text Reader

Abstract

The present application discloses a business data query method, device, server and storage medium. Belonging to the field of Internet technology, the method is applied to a business server running an ES open source distributed search engine, ES includes at least one index, the index corresponds to a data shard, and the data shard is used to store business data. The method includes: receiving a business data query request, the business data query request includes a data query condition corresponding to the target business data; according to the data query condition, determining a target index from at least one index, wherein different indexes correspond to different data classification conditions, and the data query dimension corresponding to the data query condition is the same as the data classification dimension corresponding to the data classification condition; searching for the target business data from the target data shard corresponding to the target index. Avoiding data query processes such as broadcasting data query requests to multiple data shards and integrating the query results of multiple data shards further improves data query efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of Internet technology, and in particular to a business data query method, device, server and storage medium. Background Art

[0002] In business platforms, we usually need to deal with massive amounts of stored data, such as product data, order data, etc. In order to accurately query the corresponding data, we generally use indexing to query, for example, indexing according to the product name to find the corresponding product data.

[0003] In the related technology, keywords corresponding to product data or order data can be used as index words (index fields) to search for business data matching the keywords in the database, and then the found business data are sorted by relevance to select the most relevant business data and return it to the user.

[0004] Obviously, when a certain field is used as an index word in the related technology, all business data stored in the database need to be queried and filtered according to the field, which will obviously reduce the query efficiency of the business data. Summary of the invention

[0005] The embodiment of the present application provides a business data query method, device, server and storage medium. The technical solution is as follows:

[0006] On the one hand, an embodiment of the present application provides a business data query method, the method is applied to a business server running an open source distributed search engine (Elastic Search, ES), the ES includes at least one index, the index corresponds to a data shard, the data shard is used to store business data, the method includes:

[0007] Receive a business data query request, wherein the business data query request includes a data query condition corresponding to the target business data;

[0008] According to the data query condition, a target index is determined from at least one of the indexes, wherein different indexes correspond to different data classification conditions, and a data query dimension corresponding to the data query condition is the same as a data classification dimension corresponding to the data classification condition;

[0009] The target business data is searched from the target data slice corresponding to the target index.

[0010] On the other hand, an embodiment of the present application provides a business data query device, which is applied to a business server running an ES, wherein the ES includes at least one index, the index corresponds to a data shard, and the data shard is used to store business data, and the device includes:

[0011] A first receiving module, configured to receive a business data query request, wherein the business data query request includes a data query condition corresponding to target business data;

[0012] A first determination module is used to determine a target index from at least one of the indexes according to the data query condition, wherein different indexes correspond to different data classification conditions, and a data query dimension corresponding to the data query condition is the same as a data classification dimension corresponding to the data classification condition;

[0013] A search module is used to search for the target business data from the target data slice corresponding to the target index.

[0014] On the other hand, an embodiment of the present application provides a server, which includes a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the business data query method as described in the above aspects.

[0015] On the other hand, an embodiment of the present application provides a non-temporary computer-readable storage medium on which a computer program is stored. The computer program is loaded and executed by a processor to implement the business data query method as described in the above aspects.

[0016] On the other hand, an embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program includes a computer instruction, the computer instruction is stored in a computer-readable storage medium. The processor of the server reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the server executes the business data query method provided in various optional implementations of the above aspects.

[0017] The technical solution provided in the embodiments of the present application can bring the following beneficial effects:

[0018] By improving ES, each index is set to store business data with different data classification conditions, and each index corresponds to only one data shard. When a business data query request is received, the target index consistent with the data query condition can be screened out from multiple indexes based on the data query condition contained in the business data query request, without the need to perform data query on all indexes, which can reduce useless query operations; then the target business data is searched from the single data shard corresponding to the target index, avoiding broadcasting data query requests to multiple data shards, and integrating the query results of multiple data shards, thereby reducing the data query process and further improving data query efficiency; in addition, since different indexes store business data with different data classification conditions, the data storage capacity of the data shard corresponding to each index can also be reduced, avoiding the reduction of data query rate due to the large amount of data in a single data shard, thereby further improving the query efficiency of business data. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 A schematic diagram of a data query process through ES in the related art is shown;

[0021] Figure 2 A schematic diagram of the structure of an ES shown in an exemplary embodiment of the present application is shown;

[0022] Figure 3 A schematic diagram showing an implementation environment provided by various embodiments of the present application;

[0023] Figure 4 A flowchart of a business data query method provided by an exemplary embodiment of the present application is shown;

[0024] Figure 5 A flowchart of a business data storage method shown in an exemplary embodiment of the present application is shown;

[0025] Figure 6 A flowchart of a business data storage method shown in another exemplary embodiment of the present application is shown;

[0026] Figure 7 A schematic diagram of a process of dividing business data shown in an exemplary embodiment of the present application is shown;

[0027] Figure 8A flowchart of a business data query method provided by another embodiment of the present application is shown;

[0028] Fig. 9 A flowchart of a business data query method provided by another embodiment of the present application is shown;

[0029] Fig.10 A flowchart of a business data query method provided by another embodiment of the present application is shown;

[0030] Fig.11 A schematic diagram of a user order query and order acceptance process shown in an exemplary embodiment of the present application is shown;

[0031] Fig.12 A structural block diagram of a business data query device provided by an embodiment of the present application is shown;

[0032] Fig.13 A structural block diagram of a server provided by an embodiment of the present application is shown. DETAILED DESCRIPTION

[0033] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0034] In related technologies, ES is generally used as a data query system. Based on the original ES structure, the data query process can be as follows: Figure 1 As shown in the figure, taking the index in ES consisting of 2 primary data shards and 4 secondary data shards as an example, the secondary data shards are copied versions of the primary data shards, and the business data stored on them are the same. Among them, P1 and P2 represent the primary data shards corresponding to the Index, and R1 and R2 represent the secondary data shards corresponding to the Index. ES also corresponds to multiple nodes, and each node stores two data shards to ensure data security, improve the fault tolerance of the query system, and avoid a node crash that causes data query failure.

[0035] In the data query stage, ES mainly performs the following operations:

[0036] 1. ES receives the data query request, and node1 becomes the coordinating node (corresponding to Figure 1 Step 1) in the above code.

[0037] The coordination node is used to broadcast data query requests to other nodes, or to synthesize data query results returned by other nodes.

[0038] 2. Node1 broadcasts data query requests to node2 and node3 (corresponding to Figure 1 Step 2 in the above example.

[0039] Since it is impossible to determine in which data shard the business data corresponding to the data query request is stored, it is necessary to broadcast the data query request to all data shards in the Index.

[0040] Among them, the coordination node broadcasts the data query request to R1 in node2 and P2 in node3 (all data shards in the design index).

[0041] 3. After receiving the data query request, node2 and node3 return the data query result to node1 (corresponding to Figure 1 3 and 4 in the previous step).

[0042] In the corresponding data query request receiving phase, node2 returns the data query results queried from data shard R1 to the coordinating node node1, and node3 returns the data query results queried from data shard P2 to the coordinating node node1.

[0043] 4. Node1 combines the data query results returned by node2 and node3 to obtain the document identifier (docID) related to the data query condition.

[0044] The coordination node node1 will integrate the data query results returned by node2 and node3, calculate the correlation between the query results and the query conditions, and filter out the most relevant document identifiers from the above query results according to the correlation.

[0045] Since the general query purpose of users is not to obtain the docID, but the document information corresponding to the docID, a data acquisition stage is also involved to obtain the document information corresponding to the docID.

[0046] In the data acquisition stage, the main operations performed by ES include:

[0047] 5. Node1 broadcasts information acquisition requests to node2 and node3 based on docID (corresponding to Figure 1 Step 5 in the above example).

[0048] The information acquisition request includes a docID.

[0049] The process of broadcasting an information acquisition request is similar to the process of broadcasting a data query request, and the information acquisition request needs to be broadcast to other nodes (since the documents come from different data shards, the information acquisition request needs to be broadcast to different data shards in the index).

[0050] 6. After receiving the document information acquisition request, node2 and node3 retrieve the document information corresponding to docID from the data shard and return it to the coordination node node1 (corresponding to Figure 1 6 and 7 in the previous step).

[0051] 7. After receiving all the returned document information, node1 returns the document information to the user (corresponding to Figure 1 8 in the previous step).

[0052] From the analysis of the above business data query process, it can be seen that the entire data query process needs to go through all data shards on an Index. The coordination node (node1) must broadcast the user's data query request to all data shards (or all nodes) in the Index, and then comprehensively calculate the query results of all data shards, and take the data most relevant to the query conditions from all query results returned by each data shard and return it to the user.

[0053] Correspondingly, there are two problems in the entire data query process: First, the entire query process will generate a lot of useless operations, such as: broadcasting and integrating the query results of all data shards (because the storage location of the business data cannot be determined, the data query request needs to be broadcast to all data shards, and the data needs to be retrieved from all data shards); and if the Index contains more data shards, it will lead to more useless operations; second, the coordination node needs to consume more power to integrate the query results of each data shard (because the query result received by node1 is the result of feedback from multiple data shards, the query result is the data most relevant to the query condition in each data shard. When node1 integrates the query results of multiple data shards, it needs to re-sort and filter the query results according to the correlation between each query result and the query condition).

[0054] In view of the problems in the related art, the embodiment of the present application provides a new business data query method, which is implemented based on a new ES structure. Figure 2 A schematic diagram of the structure of ES shown in an exemplary embodiment of the present application is shown. First, in the embodiment of the present application, before storing business data, the business data will be classified in advance, and the business data will be stored in different indexes according to different data classification conditions, so as to avoid storing all business data in the same index, because the query speed is slow due to the large amount of data in a single index; at the same time, unlike the related art where an Index corresponds to multiple data shards, in the embodiment of the present application, a single data shard is set for each Index in the ES to avoid useless operations when querying or updating the ES. Figure 2 As shown, the Index corresponds only to a single primary data shard (P1), and the other nodes store a copy of the primary data shard (ie, R1).

[0055] Based on the new ES structure, the query phase mainly includes the following operations:

[0056] 1. Node1 receives the user's data query request.

[0057] The data query request includes data query conditions.

[0058] 2. Node1 broadcasts the data query request to node2.

[0059] Since there is only one data shard in the Index, the business data stored in each node is the same. Therefore, there is no need to broadcast the data query request to all data nodes, but only to a single node (reaching a single data shard can realize the query of all data in the Index).

[0060] 3. Node2 returns the document identifier related to the data query request to node1 according to the data query request.

[0061] Since only one data shard is queried, there is no need to integrate and calculate the query results of multiple data shards. The data can be directly retrieved from nod2 according to the document identifier returned by node2.

[0062] 4. Node1 broadcasts an information acquisition request to node2 based on the document identifier returned by node2.

[0063] Since the document identifier only comes from a single data shard, there is no need to broadcast information acquisition requests to multiple nodes or data shards, which can further save server processing power consumption.

[0064] 5. Node2 returns the document information corresponding to the document identifier to node1.

[0065] 6. nod1 returns the document information returned by node2 to the user.

[0066] In the embodiment of the present application, by resetting the structure of ES, each Index corresponds to only a single data shard, thereby avoiding useless broadcast data query operations and operations that integrate query results of multiple data shards during the data query process, thereby reducing the query process of the server and improving query efficiency. In addition, in order to avoid storing a large amount of data on the data shard in each Index, the business data will be divided in advance according to the data classification conditions to ensure that the amount of data stored on each data shard meets the needs of fast query, further improving data query efficiency.

[0067] Based on the above business data query method, Figure 3 The schematic diagram of the implementation environment provided by each embodiment of the present application is shown. The implementation environment includes a terminal 301 and a server 302.

[0068] The terminal 301 is a device with a data query application installed. The data query application can be a search application (for querying browsing information), an order distribution application (for searching order information), etc. The terminal 301 can be a smart phone, a tablet computer, a PC, etc. In the embodiment of the present application, taking the order distribution application as an example, the user can enter the data query condition in the front-end interface of the application to query and obtain certain order information in a targeted manner, and the corresponding terminal 301 will carry the corresponding data query condition in the business data query request, so that the server 302 can find the corresponding target business data according to the data query condition.

[0069] The terminal 301 and the server 302 are connected via a wired or wireless network.

[0070] Server 302 is a background server or business server corresponding to a data query application. The server 302 is a device with storage, query, update and processing business data functions, which can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. In the embodiment of the present application, ES304 is running in server 302, and a business data query request sent by terminal 301 can be received, and according to the data query conditions contained in the business query request, the business data query request is located in the target index of ES304, and the corresponding target business data is found from the target data shard corresponding to the target index, and the target business data is fed back to terminal 301. Optionally, a relational database management system (MySQL) 303 is also provided in server 302, wherein MySQL303 is used to store business data, and ES304 is mainly responsible for business data query.

[0071] Please refer to Figure 4 , which shows a flowchart of a business data query method provided by an exemplary embodiment of the present application. The present application embodiment is applied to the method Figure 3 Taking the business server shown in FIG. 1 as an example, the method includes:

[0072] Step 401: receiving a business data query request, wherein the business data query request includes data query conditions corresponding to target business data.

[0073] Among them, the business data query method shown in the embodiments of the present application is applied to Figure 2 In the ES structure shown, ES contains at least one Index, and each Index corresponds to a data shard.

[0074] Optionally, there is no limit on the number of nodes contained in each Index. It only needs to ensure that the same data shard is stored on each node, which can be the primary data shard or the secondary data shard.

[0075] The triggering scenario for business data query requests: it can be triggered when a user makes an order query in the order distribution application interface, it can also be triggered when a user searches for data in the search interface, or it can be triggered when a business person is counting certain types of business data. The embodiments of the present application do not limit the triggering scenarios for business data query requests.

[0076] Since different categories of business data are stored in different indexes, unlike the related art in which the target business data is searched only based on index terms or keywords, the embodiment of the present application adds data query conditions based on the keywords so that the business server can accurately locate the business data query request in the target index based on the data query conditions.

[0077] Among them, the data query conditions can be set based on the data classification conditions of different indexes in ES.

[0078] Step 402, determining a target index from at least one index according to a data query condition, wherein different indexes correspond to different data classification conditions, and a data query dimension corresponding to the data query condition is the same as a data classification dimension corresponding to the data classification condition.

[0079] Since the index shown in the embodiment of the present application only corresponds to a single data shard, in order to ensure data query efficiency, the amount of data stored in the data shard corresponding to each index cannot be too much. Therefore, it is necessary to classify the business data in order to reduce the amount of business data stored in each data shard. Correspondingly, each index is set to store business data with different data classification conditions.

[0080] Among them, the data classification conditions include at least one data classification dimension, which is set by business personnel according to different types of business data. For example, if the business data is commodity data, the corresponding data classification dimensions may be: commodity origin, commodity production time, commodity price, etc.; if the business data is order data, the corresponding data classification dimensions may be: order delivery origin, order delivery destination, order delivery time, order delivery method, etc. The data classification dimensions of the business data in the embodiment of the present application do not constitute a limitation.

[0081] In order to correctly locate the target index according to the data query conditions during the data query process, avoid data query on all indexes in ES, and improve data query efficiency, therefore, in a possible implementation, the data query dimension corresponding to the data query condition is set to be consistent with the data classification dimension corresponding to the data classification condition.

[0082] When the user selects a data query dimension in the front-end interface of the application to query, the terminal determines the data query condition based on the data query dimension, and sends the business data query request containing the data query condition to the business server. Correspondingly, the business server determines the target index from multiple indexes based on the received data query condition and the data classification conditions corresponding to each index in ES, and locates the data query request to the target index.

[0083] In an illustrative example, if the data query condition is that the order delivery time is 2020-10-01, then correspondingly, the data query dimension is the order delivery time. When the server receives the data query condition, it determines from multiple indexes that the data classification condition is the target index of the order delivery time 2020-09-30 to 2020-10-03 (including the order data of 2020-10-01), and then the business data query request can be located in the target index accordingly.

[0084] Step 403: Search for target business data from the target data slice corresponding to the target index.

[0085] Different from the related art, each index contains multiple data shards. When querying business data in the index, since it is impossible to determine in advance which data shard the business data is stored in, it is necessary to broadcast data query requests to multiple data shards, and it is necessary to integrate the query results of multiple data shards, resulting in a large number of useless operations in the entire query process (for example, some data shards do not have target business data, but it is still necessary to broadcast data query requests to the data shard). In the embodiment of the present application, each index corresponds to only a single data shard. Correspondingly, after locating the target index, the data query request can be broadcast to the target data shard (single data shard) corresponding to the target index, without broadcasting to multiple data shards, saving signaling expenses; and only the target business data returned by the target data shard will be obtained, without the need to integrate the query results of multiple data shards, further reducing the processing volume of the server, thereby improving data query efficiency.

[0086] In summary, in the embodiment of the present application, by improving ES, each index is set to store business data with different data classification conditions, and each index corresponds to only one data shard. When a business data query request is received, the target index consistent with the data query condition can be screened out from multiple indexes based on the data query condition contained in the business data query request, without the need to perform data query on all indexes, which can reduce useless query operations; then the target business data is searched from a single data shard corresponding to the target index, avoiding broadcasting data query requests to multiple data shards, and integrating the query results of multiple data shards, thereby reducing the data query process and further improving the data query efficiency; in addition, since business data with different data classification conditions are stored in different indexes, the data storage capacity of the data shard corresponding to each index can also be reduced, avoiding the large amount of data in a single data shard and reducing the data query rate, thereby further improving the query efficiency of business data.

[0087] Since the business data query methods provided in the embodiments of the present application are all implemented based on the new ES structure, in order to ensure efficient data query in the new ES structure, the process of storing business data according to data classification conditions is more important. Only by correctly dividing the storage data of each Index in ES can the guarantee of data query efficiency be achieved. The following embodiments will focus on describing how to divide business data and how to store business data in ES.

[0088] Please refer to Figure 5 , which shows a flowchart of a business data storage method shown in an exemplary embodiment of the present application. The present application embodiment is applied to the method Figure 3 Taking the business server shown in FIG. 1 as an example, the method includes:

[0089] Step 501, determining the target data classification dimension corresponding to the business data based on the business data.

[0090] Since each index in the present application corresponds to only a single data shard, in order to avoid storing a large amount of data in each data shard and affecting the data query efficiency, that is, the data query efficiency is negatively correlated with the amount of data stored in the data shard, it is necessary to determine the data classification dimension of the business data based on the business data in advance, and then determine the data classification conditions corresponding to each index based on the data classification dimension.

[0091] Among them, the setting method of data classification dimensions can refer to the above embodiment, and this embodiment will not be repeated here.

[0092] Since there are many optional data classification dimensions, it is unclear according to which data classification dimension or dimensions the data should be divided. In one possible implementation, in order to ensure data query efficiency, the data can be divided based on the magnitude of the business data and the maximum data storage capacity corresponding to the data shard.

[0093] exist Figure 5 On the basis of Figure 6 As shown, step 501 may include step 501A and step 501B.

[0094] Step 501A, in response to the data volume of the business data corresponding to the candidate data classification dimension being greater than the maximum data storage volume, a new data classification dimension is added based on the candidate data classification dimension, or the candidate data classification dimension is divided into at least two sub-data classification dimensions to obtain the target data classification dimension.

[0095] Among them, the maximum data storage capacity is less than or equal to the data storage capacity of a single data shard, and the data storage capacity can ensure high query efficiency when querying the data shard.

[0096] For example, the maximum data storage capacity is 40GB.

[0097] In order to ensure data query efficiency, based on the fact that different indexes correspond to different data classification conditions, it is necessary to ensure that the amount of business data corresponding to each data classification condition is less than the maximum data storage capacity. Therefore, when determining the target data classification dimension, it is necessary to consider the relationship between the data amount corresponding to the target data classification dimension and the maximum data storage capacity.

[0098] In one possible implementation, if the amount of business data corresponding to the candidate data classification dimension is greater than the maximum data storage capacity, it means that if the business data is divided based on the candidate data classification dimension, there may be a certain type of business data with a large amount of data, which affects the data query efficiency, and it is necessary to divide this type of business data into more dimensions. This type of business data can be divided into multiple sub-types of business data by adding a new data dimension or dividing a certain data dimension into at least two sub-data dimensions, until it is ensured that after the business data is divided based on the target data dimension, the amount of data corresponding to each type of business data is less than the maximum data storage capacity.

[0099] In an illustrative example, multiple levels of data classification dimensions are pre-customized, for example, a first data classification dimension, a second data classification dimension to an nth data classification dimension are pre-customized. The business data can be first divided according to the first data classification dimension to obtain k types of business data, and the data volume corresponding to each type of business data is analyzed. If there is at least one type of business data among the k types of business data with a data volume greater than the maximum data storage volume, it is necessary to divide the type of business data with a data volume greater than the maximum data storage volume again. Specifically, the second data classification dimension can be used to divide this type of business data, or the first data classification dimension can be divided into two first sub-data classification dimensions; correspondingly, the target data classification dimension at this time becomes "first data classification dimension + second data classification dimension" or "at least two first sub-data classification dimensions". Similarly, if after division according to the target data classification dimension, there is still a large amount of data in a certain type of business data after analysis, the data dimension can be increased or the data dimension can be divided more finely.

[0100] like Figure 7 As shown, taking the first data dimension as the country dimension, the second data dimension as the time dimension, and the third data dimension as other dimensions as an example, it shows a schematic diagram of the division process of business data shown in an exemplary embodiment of the present application. First, the business data is divided according to the country dimension. For example, the business data comes from country A, country B, country C and country D. Then, the business data is first divided into four categories of business data according to these four countries. After analyzing the business data corresponding to different country dimensions, it is found that the amount of business data corresponding to country D is large and greater than the maximum data storage capacity (data sharding). Then, the business data corresponding to country D is further divided, and the time dimension is added. That is, the business data corresponding to country D is divided according to the time dimension to obtain the business data corresponding to time period A, time period B, time period C and time period D respectively. If the analysis finds that the business data corresponding to time period D is still large, then the data dimension is added, such as other dimensions, that is, the business data corresponding to time period D is divided according to other dimensions to obtain three categories of business data. At this time, it is found that the amount of data of each category of business data is relatively balanced and less than the maximum data storage capacity. The target data classification dimension of the corresponding business data is "country dimension + time dimension + other dimensions".

[0101] Step 501B: in response to the data volume of the business data corresponding to the candidate data classification dimension being less than the maximum data storage volume, the candidate data classification dimension is determined as the target data classification dimension.

[0102] Similar to the above, when it is determined that the amount of business data corresponding to the candidate data classification dimension is less than the maximum data storage capacity, it means that after dividing the business data according to the candidate data classification dimension, a faster data query rate can be achieved. Therefore, the candidate data classification dimension can be directly determined as the target data classification dimension.

[0103] Step 502: Determine the data classification condition corresponding to the business data according to the dimension value corresponding to the target data classification dimension.

[0104] Among them, the dimension value corresponding to the data classification dimension indicates the common characteristic value of each type of business data after the business data is divided according to the data classification dimension. For example, if the business data is divided according to the country dimension, the common characteristic of each type of business data is the country name.

[0105] In a possible implementation, the data classification condition corresponding to each type of business data may be determined according to the dimension value corresponding to the target data classification dimension.

[0106] like Figure 7 As shown, after dividing the business data according to the country dimension, the business data corresponding to country A, country B, country C and country D are obtained. For the business data stored in country C, the corresponding data classification condition is country C, and for the business data corresponding to time period C, the corresponding data classification condition is country D + time period C.

[0107] Step 503: Determine at least one index name corresponding to the business data according to the data classification condition.

[0108] Since different indexes store business data corresponding to different data classification conditions, and the data query dimension corresponding to the data query condition is consistent with the data classification dimension, in order to facilitate the subsequent accurate positioning of the index storing the target business data according to the data query condition, the data classification condition can be directly used as the index name of each index to facilitate the subsequent data query process.

[0109] In an illustrative example, for example, if the data classification condition corresponding to a certain index is country D+time period A, then the corresponding index name may be “country D+time period A”.

[0110] In a possible implementation, if the business data is order data, the data classification condition indicates that the business data is divided according to the country dimension and the time dimension, and the time dimension is divided into three parts, then the algorithm for calculating the Index name can be expressed as:

[0111] Index name =orderCountry+orderTime.Day%11

[0112] Among them, Index name Represents the index name, orderCountry represents the country name corresponding to the order data, orderTime.Day represents the order time, and % represents the remainder, that is, orderTime.Day%11 represents the remainder of the order time divided by 11.

[0113] Step 504: Store the business data in an index corresponding to at least one index name.

[0114] In a possible implementation, after the business data has been divided into different categories according to the above data classification conditions, different indexes may be set for different data classification conditions, and the business data of this type may be stored in the corresponding index.

[0115] In another possible application scenario, if additional business data is needed later on the basis of multiple indexes already created in ES, and if the additional business data is a new dimension value on a certain data dimension, a new index needs to be created for the new dimension value. For example, the country dimension originally has countries A to D, but the new business data corresponds to country E. In this case, you first need to create an index corresponding to country E, and then store the additional business data in the newly added index.

[0116] In this embodiment, the data classification dimension of the business data is determined by the data volume of the business data and the maximum data storage capacity of the data shards, so that the data volume of the business data corresponding to each data classification condition can ensure faster data query efficiency and avoid the problem of uneven data storage capacity in different indexes in ES.

[0117] In another possible application scenario, if you need to add new business data to an already created index, after adding the new business data, the total amount of data corresponding to the newly added business data and the stored business data may be large, thereby affecting the data query efficiency corresponding to the index. Therefore, when adding new business data, the maximum data storage capacity of the data shard must also be considered.

[0118] exist Figure 5 On the basis of Figure 6 As shown, after the business data is stored in the corresponding index according to the data classification condition, the method further includes steps 601 to 605.

[0119] Step 601: Receive a data addition request for business data stored in an index, and obtain the data volume of the newly added business data corresponding to the data addition request.

[0120] This embodiment describes the data storage process for a scenario in which an index has been created and some business data is stored in the index.

[0121] In one possible implementation, when a business server receives a data addition request and determines, based on the business data corresponding to the data addition request, that it should be stored in a created index, in order to avoid storing the newly added business data in the index, resulting in a large amount of data in the index (which may exceed the maximum data storage capacity), thereby reducing the data query rate, it is necessary to obtain the data amount corresponding to the newly added business data to determine whether the newly added business data can be directly stored in the index.

[0122] Step 602: Determine the total data volume corresponding to the index according to the data volume of the newly added business data and the data volume of the stored business data.

[0123] The stored business data refers to the business data stored in the index when the data addition request is received.

[0124] In a possible implementation, the amount of stored business data is obtained, and the sum of the amount of stored business data and the amount of newly added business data is calculated to estimate the total amount of business data that the index may reach after adding new business data.

[0125] In an illustrative example, if the amount of stored business data is 30 GB and the amount of newly added business data is 20 GB, it is estimated that after the new business data is added to the index, 50 GB of data may be stored in the data shard of the index.

[0126] Step 603, in response to the total data volume being greater than the maximum data storage volume, a new data classification dimension is added to the data classification condition corresponding to the index, or the target data classification dimension corresponding to the data classification condition is divided into at least two sub-data classification dimensions.

[0127] In one possible implementation, if the estimated total data volume exceeds the maximum data storage capacity of the data shard, in order to avoid more data affecting data query efficiency, the business data corresponding to the index needs to be re-divided. The specific implementation method can be to add a new data classification dimension to the data classification condition corresponding to the index, or to divide the target data classification dimension corresponding to the data classification condition into at least two sub-data classification dimensions.

[0128] In an illustrative example, if the total data volume is 50GB, the maximum data storage capacity of the data shard is 40GB, and the total data volume is greater than the maximum data storage capacity, if the newly added business data continues to be stored in the index, it will obviously affect the data query rate of the index. Therefore, the newly added business data and the stored business data need to be re-divided.

[0129] Regarding the division method of new business data and stored business data, in one possible implementation, a new data classification dimension can be added to the data classification condition. For example, the data classification condition corresponding to the index includes the first data classification dimension and the second data classification dimension. In order to perform a more detailed classification of the business data corresponding to the index, a third data classification dimension can be added to the data classification condition, that is, the data classification condition becomes "first data classification dimension + second data classification dimension + third data classification dimension".

[0130] In an illustrative example, if the index corresponds to business data corresponding to country A, after discovering that new business data is added to the index, the amount of business data corresponding to country A exceeds the maximum data storage capacity, then a city dimension can be added to the data classification conditions, that is, the business data corresponding to country A is divided again according to different cities, and the resulting data classification conditions include "country A+city X".

[0131] Optionally, a data classification dimension in the data classification condition corresponding to the index can also be divided into at least two sub-data classification dimensions. For example, if the data classification condition corresponds to the time dimension, where the time dimension divides data according to each month, if the business data corresponding to a certain month exceeds the maximum data storage capacity, then the month is divided into three parts based on the time dimension divided by month, that is, the target time dimension is divided into at least two sub-data dimensions (at least two sub-time periods).

[0132] In an illustrative example, if the index corresponds to the business data stored in March, after analyzing the newly added business data in the index, the data volume of the business data corresponding to March exceeds the maximum data storage capacity, then the time dimension of March can be divided into at least two sub-data classification dimensions, for example, business data divided into three time periods, namely, the three time periods of 1-10, 11-20, and 21 to 30.

[0133] Step 604: Store the stored business data and the newly added business data in at least two indexes respectively, and the data classification conditions corresponding to the at least two indexes include a newly added data classification dimension or a sub-data classification dimension.

[0134] In one possible implementation, after the business data corresponding to the index is divided, new data classification conditions will appear. Based on the principle that different data classification conditions correspond to different indexes, a new index is created for the new data classification conditions, and the stored business data and the new business data are re-divided according to the new data classification conditions, and stored in the corresponding new index according to the corresponding data classification conditions.

[0135] In an illustrative example, after the business data corresponding to the index (stored business data + newly added business data) is re-divided, if the data classification condition corresponding to the original index is country A, after re-division, the data classification condition corresponding to the business data becomes "country A + city A", "country A + city B" and "country A + city C", then it is necessary to create index names and indexes for these newly added data classification conditions, and store the stored business data and the newly added business data in the indexes corresponding to "country A + city A", "country A + city B" and "country A + city C" respectively.

[0136] In another possible application scenario, if the sum of the data volume of the newly added business data and the data volume of the stored business data (the total data volume) is less than the maximum data storage volume, the newly added business data can be directly stored in the index.

[0137] In this embodiment, the storage method of the new business data is determined by comparing the relationship between the total data volume of the new business data and the stored business data and the maximum data storage volume, so as to avoid the situation where the data volume in the index exceeds the maximum data volume threshold after the new business data is added to a certain index, thereby affecting the data query efficiency, and further improving the data query efficiency.

[0138] The above embodiment describes the storage process of business data. Since when storing business data, a corresponding index is first set for it based on the data classification conditions of the business data, during the data query process, the data query request can be directly located to the target index that meets the data query conditions based on the data query conditions, so as to avoid searching in other indexes where the business data does not exist, thereby improving data query efficiency.

[0139] Please refer to Figure 8 , which shows a flowchart of a business data query method provided by another embodiment of the present application. The present application embodiment applies this method to Figure 3 Taking the business server shown in FIG. 1 as an example, the method includes:

[0140] Step 801: receiving a business data query request, wherein the business data query request includes data query conditions corresponding to target business data.

[0141] Among them, the data query dimension corresponding to the data query condition is consistent with the data classification dimension corresponding to the data classification condition. After the business data is stored in the index, the data classification dimensions of each index can be combined to set the data query dimension corresponding to the data query condition.

[0142] In an illustrative example, for example, the data classification dimensions include country dimension, city dimension, time dimension, etc., then the corresponding data query dimensions also include: country dimension, city dimension, time dimension, etc.

[0143] For example, if a user selects the country dimension in the front-end interface of the application and selects country A, the corresponding data query condition is country A.

[0144] Step 802, determining the dimension value corresponding to each data query dimension according to the data query condition.

[0145] In a possible implementation, after receiving a data query request including a data query condition, the server obtains a data query dimension indicated by the data query condition and a dimension value corresponding to the data query dimension.

[0146] In an illustrative example, if a user needs to query the business data corresponding to city C in country B, the data query condition included in the business data query request is: country B + city C. The business server determines, based on the data query condition, that the data query condition corresponds to two data query dimensions, namely the country dimension and the city dimension. The dimension values ​​corresponding to each data query dimension are: the dimension value corresponding to the country dimension is country B, and the dimension value corresponding to the city dimension is city C.

[0147] Step 803: Determine the target index name according to the dimension value corresponding to each data query dimension.

[0148] Since the data query dimension and the data classification dimension are consistent, and the index name corresponds to the data classification condition, in a possible implementation, the target index name indicated by the data query condition can be determined from the multiple index names that have been created based on the dimension values ​​corresponding to each data query dimension.

[0149] In a possible implementation, if there is a target index name whose index name is the same as the dimension value corresponding to the data query condition, it indicates that the business data query request corresponds to a single target index.

[0150] For example, if the data query condition is country B, that is, the user needs to query the business data of country B, and there happens to be a target index named country B in the index name, then the target index corresponding to country B is the index corresponding to the business data query request.

[0151] Optionally, if there is no index name that is exactly the same as the dimension value corresponding to the data query dimension, but there is an index name that contains the dimension value, then at least one index name that contains the dimension value can be determined as the target index name.

[0152] For example, if the data query condition is country D, there are index names such as "country D+city A", "country D+city B" and "country D+city C" in the index name, indicating that the business data of country D is divided into three categories. In this case, the above three index names will be determined as the target index names accordingly.

[0153] Step 804: determine a target index from at least one index according to the target index name.

[0154] Since the index name and the index have a unique correspondence, the target index corresponding to the data query request can be directly determined from at least one index in the ES based on the determined at least one target index name, and the business data query request can be located to the target index.

[0155] Step 805: Search for target business data from the target data slice corresponding to the target index.

[0156] The implementation of this step can refer to the above embodiment, and this embodiment will not be described in detail here.

[0157] In this embodiment, a process of determining a target index based on data query conditions is described. By analyzing the various data query dimensions contained in the data query conditions and the dimension values ​​corresponding to each data query dimension, and based on the correspondence between the data classification dimensions and the data query dimensions, the target index name corresponding to the business data query request is determined, which is conducive to quickly locating the target index containing the target business data, avoiding initiating business data query requests to all indexes, and thus improving the query rate of business data.

[0158] In the related art, MySQL is generally set up in the business server to store business data, and ES is generally responsible for business data query. When updating business data, the business data in MySQL is generally updated first. However, due to the data update delay of ES, that is, the business data in ES generally does not have the ability to perceive data updates in a timely manner, the business data in ES is generally refreshed every preset time period. For example, the business data in ES is refreshed every 3 minutes. Obviously, it is impossible to update the business data in real time. If the business data in MySQL updates some business data at 10:10:30, at this time, ES cannot perceive that the business data has been updated. It may perform a refresh operation after 3 minutes and update its own business data according to the business data in MySQL. Obviously, within 3 minutes after MySQL updates the business data, the business data in ES still maintains the state before the update. During these 3 minutes, users may not be able to find the updated business data in ES, or the business data obtained by users may be inconsistent with the business data in MySQL, thereby affecting the query accuracy of business data. Therefore, in a possible implementation, a method of writing data back to MySQL is adopted to achieve timely update of business data in ES and ensure the consistency of data in MySQL and ES.

[0159] In an illustrative example, Fig. 9 As shown, it shows a flowchart of a business data query method provided by another embodiment of the present application. The embodiment of the present application is applied to the method Figure 3 Taking the business server shown in FIG. 1 as an example, the method includes:

[0160] Step 901: receiving a business data query request, wherein the business data query request includes a data query condition corresponding to target business data.

[0161] Step 902: determine a target index from at least one index according to a data query condition, wherein different indexes correspond to different data classification conditions, and a data query dimension corresponding to the data query condition is the same as a data classification dimension corresponding to the data classification condition.

[0162] Step 903: Search for target business data from the target data slice corresponding to the target index.

[0163] Step 904: In response to a business data update request for target business data, obtain a data identifier corresponding to the target business data.

[0164] The business data update request is triggered after the target business data is found.

[0165] For the scenario where a business data update request is triggered after the target business data is found, it may be that the business personnel need to update the target business data, first find the target business data from ES, obtain the data identifier corresponding to the target business data, and then update the target business data in MySQL according to the data identifier corresponding to the target business data; it may also be some special types of target business data, such as product orders. When accepting an order, the user needs to first filter out the target product order according to the order screening conditions, which means that the user is determined to accept this part of the target product order, which will trigger the order status update of the target product order, such as updating from the unaccepted order status to the accepted order status. The embodiments of the present application do not limit the scenarios that trigger business data update requests.

[0166] The data identifier is the unique identifier of the target business data in MySQL and is set by business personnel for the target business data.

[0167] Step 905: Update the target business data stored in MySQL according to the data identifier.

[0168] Since the data storage structure in MySQL is different from that in ES, MySQL provides a function for searching for target business data based on data identifiers. Therefore, in one possible implementation, when it is perceived that the target business data may be updated, the target business data stored in MySQL can be first found based on the data identifier and updated accordingly.

[0169] Step 906 , in response to the target business data in MySQL being updated, the target business data in the target index is updated according to the updated target business data.

[0170] Since data consistency needs to be ensured in MySQL and ES, and in the related art, the consistency of business data is generally maintained by performing refresh operations at preset time intervals, which may result in the updates within the preset time period not being updated to ES in a timely manner, that is, the business data in MySQL has been updated, but the business data in ES has not been updated. Therefore, in an embodiment of the present application, it is arranged that after sensing that the update of the target business data in MySQL is completed, the target business data in the target index is immediately updated according to the updated target business data, thereby avoiding the situation where the business data in MySQL and ES are inconsistent.

[0171] In this embodiment, MySQL is associated with ES so that after receiving a business data update request, the business data of MySQL is updated first, and then the business data in ES is immediately updated according to the business data in MySQL, thereby avoiding the situation where the business data in ES is inconsistent with the business data in MySQL due to periodic refresh of the business data in ES, thereby improving the accuracy of business data queried by users.

[0172] The above embodiments describe the process of updating business data. This embodiment takes the application of the business data updating process to the order distribution scenario as an example to describe the process of a user querying an order and accepting an order.

[0173] In an illustrative example, Fig.10 As shown, it shows a flowchart of a business data query method provided by another embodiment of the present application. The embodiment of the present application is applied to the method Figure 3 Taking the business server shown in FIG. 1 as an example, the method includes:

[0174] Step 1001: receiving a product order query request, wherein the product order query request includes data query conditions corresponding to a target product order.

[0175] Taking the order distribution scenario as an example, in the related technologies, the modes of order distribution systems mainly include dispatching orders and grabbing orders. Generally, the server side dispatches suitable orders to suitable users based on the research and analysis of a large number of user behaviors. If the user behavior or preference changes, the server side cannot immediately adjust the order distribution strategy, which may lead to the user refusing to accept the order after the order is dispatched, thus affecting the efficiency of order distribution.

[0176] In response to the problems in the related technology, the business data query method in this application is adopted and applied to the order distribution scenario. From the user's perspective, the user can filter the order in the front-end interface of the application, and the corresponding terminal will send a product order query request to the business server. The product order query request will carry the order query conditions (data query conditions) entered by the user, so that the business server can distribute product orders that meet the needs of the user to avoid the situation where no one accepts the order, thereby improving the efficiency of order distribution.

[0177] Step 1002: determine a target index from at least one index according to a data query condition, wherein different indexes correspond to different data classification conditions, and a data query dimension corresponding to the data query condition is the same as a data classification dimension corresponding to the data classification condition.

[0178] The implementation of this step can refer to the above embodiment, and this embodiment will not be described in detail here.

[0179] Step 1003, searching for the target product order from the target data slice corresponding to the target index.

[0180] For the order distribution scenario, the corresponding business data stored in ES is the product order data. Correspondingly, after finding the target product order corresponding to the order query condition from the target index, the target product order is returned to the terminal (user client).

[0181] Step 1004: in response to finding the target product order corresponding to the product order query request, obtain an order identifier corresponding to the target product order.

[0182] In order to further improve the distribution efficiency of product orders, it is assumed that the target product orders found by the user are the product orders accepted by the user. That is, if ES returns the target product orders, the order status of these target product orders will be changed by default. For example, from the unaccepted order status to the accepted order status, the order status of the target product orders in MySQL and ES needs to be updated accordingly. Therefore, after the target product order is found, it is determined by default that the data update request for the target product order has been received, and the order identifier corresponding to the target product order is obtained for subsequent updating of the order status of the target product order.

[0183] Optionally, after the business server returns the found target product order to the user client, the user can view the target product order in the front-end interface of the application. For the returned target product orders, the user can select one or more target product orders from them. The corresponding business server then receives the selection operation on the target product order, indicating that the user is determined to accept the target product order, and obtains the order ID of the target product order for subsequent updating of the order status of the product order.

[0184] Step 1005: Update the order status corresponding to the target product order in MySQL according to the order identifier.

[0185] Among them, corresponding to the order distribution system, the order status can be an accepted order status, an unaccepted order status, a delivered status, a distribution status, etc., and the embodiments of the present application do not constitute a limitation on this.

[0186] Since the embodiment of the present application associates the user order query operation with the user order acceptance operation, it is assumed that the user finds the target product order, that is, it is necessary to undertake this part of the target product order, then the order status corresponding to the target product order is changed from an unaccepted order status to an accepted order status. At this time, it is necessary to first update the order status corresponding to the target product order in MySQL according to the order identifier.

[0187] Step 1006, in response to the order status corresponding to the target product order in MySQL being updated, the order status corresponding to the target product order in the target index is updated according to the updated order status.

[0188] In order to ensure the consistency of business data in MySQL and ES, and to avoid the situation where the order status in MySQL has been updated to the accepted order status, but the order status in ES is still the unaccepted order status, resulting in the situation where other users query the unaccepted order of goods and the accepted order is returned to the user, causing errors in order query and subsequent order acceptance. Therefore, in a possible implementation method, when the business server perceives that the order status in MySQL has changed (that is, the order status update is completed), the order status in ES is immediately updated according to the updated order status to ensure the consistency of the order status in real time.

[0189] In another possible application scenario, when the order status in MySQL is updated, it means that the user has successfully accepted the order, and the order update result is returned to the user client.

[0190] In this embodiment, taking the order distribution scenario as an example, user query orders and distribution orders are associated. When a user initiates an order query request to the business server, the business server will allocate the product orders that meet the order query conditions to the user, thereby improving the efficiency of distributing orders.

[0191] Please refer to Fig.11, which shows a schematic diagram of a user querying an order and receiving an order process shown in an exemplary embodiment of the present application. The user enters the order query conditions in the front-end interface of the order distribution application, and the corresponding terminal sends the order query request containing the order query conditions to the request preprocessing module 1101 in the business server. In the request preprocessing module 1101, the target index name is determined according to the order query conditions, and the target index name is sent to the ES request processing module 1102. The ES request processing module 1102 locates the order query request to the target index (i.e., index 1) corresponding to the target index name in ES1105, searches for the order data information corresponding to the order query request in index 1, and returns the order data information to the ES request processing module 1102. , the ES request processing module 1102 sends an order status information update request to MySQL1104 through the MySQL request processing module 1103. The order status information update request contains the order identifier corresponding to the order data information. MySQL1104 updates the order status information according to the order identifier (for example, from the unaccepted order status to the accepted order status). When the order status information in MySQL1104 is updated, the order status information is synchronized to the index 1 of ES1105 through the business data synchronization module 1106; at the same time, MySQL1104 feeds back the order status information update result to the user, indicating that the user has successfully accepted the order.

[0192] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0193] Please refer to Fig.12 , which shows a structural block diagram of a business data query device provided by an embodiment of the present application. The device has the function of implementing the above method embodiment, and the function can be implemented by hardware or by hardware executing corresponding software. Fig.12 As shown, the device may include:

[0194] The first receiving module 1201 is used to receive a business data query request, where the business data query request includes a data query condition corresponding to the target business data;

[0195] A first determining module 1202 is configured to determine a target index from at least one of the indexes according to the data query condition, wherein different indexes correspond to different data classification conditions, and a data query dimension corresponding to the data query condition is the same as a data classification dimension corresponding to the data classification condition;

[0196] The search module 1203 is used to search for the target business data from the target data slice corresponding to the target index.

[0197] Optionally, the first determining module 1202 includes:

[0198] A first determining unit, configured to determine a dimension value corresponding to each of the data query dimensions according to the data query condition;

[0199] A second determining unit, configured to determine a target index name according to dimension values ​​corresponding to each of the data query dimensions;

[0200] The third determining unit is used to determine the target index from at least one of the indexes according to the target index name.

[0201] Optionally, the device further comprises:

[0202] A second determination module is used to determine, according to the business data, a target data classification dimension corresponding to the business data;

[0203] A third determination module, used to determine the data classification condition corresponding to the business data according to the dimension value corresponding to the target data classification dimension;

[0204] A fourth determination module, configured to determine at least one index name corresponding to the business data according to the data classification condition;

[0205] The first storage module is used to store the business data in the index corresponding to at least one of the index names.

[0206] Optionally, the data shard has a maximum data storage capacity;

[0207] The second determining module includes:

[0208] a fourth determining unit, configured to, in response to the data volume of the business data corresponding to the candidate data classification dimension being greater than the maximum data storage volume, add a data classification dimension on the basis of the candidate data classification dimension, or divide the candidate data classification dimension into at least two sub-data classification dimensions, to obtain the target data classification dimension;

[0209] A fifth determining unit is configured to determine the candidate data classification dimension as the target data classification dimension in response to the data volume of the business data corresponding to the candidate data classification dimension being smaller than the maximum data storage volume.

[0210] Optionally, the device further comprises:

[0211] A second receiving module is used to receive a data addition request for the service data stored in the index, and obtain the data volume of the newly added service data corresponding to the data addition request;

[0212] A fifth determination module, configured to determine a total data volume corresponding to the index according to the data volume of the newly added business data and the data volume of the stored business data;

[0213] a sixth determining module, configured to, in response to the total data volume being greater than the maximum data storage volume, add a data classification dimension to the data classification condition corresponding to the index, or divide the target data classification dimension corresponding to the data classification condition into at least two sub-data classification dimensions;

[0214] The second storage module is used to store the stored business data and the newly added business data in at least two of the indexes respectively, and the data classification conditions corresponding to at least two of the indexes include the newly added data classification dimension or the sub-data classification dimension.

[0215] Optionally, the business server is further provided with a MySQL relational database management system, and the MySQL and the ES store the same business data;

[0216] The device also includes:

[0217] A first acquisition module, configured to acquire a data identifier corresponding to the target business data in response to a business data update request for the target business data;

[0218] A first updating module, used for updating the target business data stored in the MySQL according to the data identifier;

[0219] The second updating module is used to update the target business data in the target index according to the updated target business data in response to the target business data in the MySQL being updated.

[0220] Optionally, the business data query request is a product order query request, and the business data update request is triggered when a target product order corresponding to the product order query request is queried;

[0221] The device also includes:

[0222] A second acquisition module, configured to acquire an order identifier corresponding to the target product order in response to finding the target product order corresponding to the product order query request;

[0223] A third updating module, configured to update the order status corresponding to the target product order in the MySQL according to the order identifier, wherein the order status includes at least one of an order-accepted state and an order-unaccepted state;

[0224] A fourth updating module is used to update the order status corresponding to the target commodity order in the target index according to the updated order status in response to completion of updating the order status corresponding to the target commodity order in the MySQL.

[0225] In summary, in the embodiment of the present application, by improving ES, each index is set to store business data with different data classification conditions, and each index corresponds to only one data shard. When a business data query request is received, the target index consistent with the data query condition can be screened out from multiple indexes based on the data query condition contained in the business data query request, without the need to perform data query on all indexes, which can reduce useless query operations; then the target business data is searched from a single data shard corresponding to the target index, avoiding broadcasting data query requests to multiple data shards, and integrating the query results of multiple data shards, thereby reducing the data query process and further improving the data query efficiency; in addition, since business data with different data classification conditions are stored in different indexes, the data storage capacity of the data shard corresponding to each index can also be reduced, avoiding the large amount of data in a single data shard and reducing the data query rate, thereby further improving the query efficiency of business data.

[0226] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0227] Please refer to Fig.13 , which shows a structural block diagram of a server provided in one embodiment of the present application. The server can be used to implement the business data query method provided in the above embodiment. Specifically:

[0228] The server 1300 includes a central processing unit (CPU) 1301, a system memory 1304 including a random access memory (RAM) 1302 and a read-only memory (ROM) 1303, and a system bus 1305 connecting the system memory 1304 and the central processing unit 1301. The server 1300 also includes a basic input / output system (I / O system) 1306 for facilitating information transmission between various components in the server, and a large-capacity storage device 1307 for storing an operating system 1313, application programs 1314, and other program modules 1315.

[0229] The basic input / output system 1306 includes a display 1308 for displaying information and an input device 1309 such as a mouse and a keyboard for user inputting information. The display 1308 and the input device 1309 are connected to the central processing unit 1301 through an input / output controller 1310 connected to the system bus 1305. The basic input / output system 1306 may also include an input / output controller 1310 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1310 also provides output to a display screen, a printer, or other types of output devices.

[0230] The mass storage device 1307 is connected to the central processing unit 1301 via a mass storage controller (not shown) connected to the system bus 1305. The mass storage device 1307 and its associated computer-readable storage medium provide non-volatile storage for the server 1300. That is, the mass storage device 1307 may include a computer-readable storage medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0231] Without loss of generality, the computer-readable storage medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable storage instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassette, tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 1304 and mass storage device 1307 can be collectively referred to as memory.

[0232] The memory stores one or more programs, and the one or more programs are configured to be executed by one or more central processing units 1301. The one or more programs contain instructions for implementing the above-mentioned method embodiments. The central processing unit 1301 executes the one or more programs to implement the business data query method provided by the above-mentioned method embodiments.

[0233] According to various embodiments of the present application, the server 1300 can also be connected to a remote server on the network through a network such as the Internet. That is, the server 1300 can be connected to the network 1312 through the network interface unit 1311 connected to the system bus 1305, or the network interface unit 1311 can be used to connect to other types of networks or remote server systems (not shown).

[0234] The memory also includes one or more programs, which are stored in the memory and include steps executed by the business server in the method provided in the embodiment of the present application.

[0235] An embodiment of the present application further provides a computer-readable storage medium, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the business data query method described in the above embodiments.

[0236] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a server reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the server executes the business data query method provided in various optional implementations of the above aspects.

[0237] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.

[0238] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A business data query method, characterized in that: The method is applied to a business server running an ES open source distributed search engine, wherein the ES includes at least one index, each of the indexes corresponds to a single data shard, the data shard is used to store business data, and the data shard has a maximum data storage capacity, and the method includes: In response to the data volume of the business data corresponding to the candidate data classification dimension being greater than the maximum data storage volume, adding a new data classification dimension on the basis of the candidate data classification dimension, or dividing the candidate data classification dimension into at least two sub-data classification dimensions, to obtain a target data classification dimension; In response to the data volume of the business data corresponding to the candidate data classification dimension being less than the maximum data storage volume, determining the candidate data classification dimension as the target data classification dimension; Determining a data classification condition corresponding to the business data according to a dimension value corresponding to the target data classification dimension; Determining at least one index name corresponding to the business data according to the data classification condition; storing the business data in the index corresponding to at least one of the index names, wherein different indexes store the business data meeting different data classification conditions; receiving a data addition request for the service data stored in the index, and obtaining a data volume of the newly added service data corresponding to the data addition request; Determining the total data volume corresponding to the index according to the data volume of the newly added business data and the data volume of the stored business data; In response to the total data volume being greater than the maximum data storage volume, adding a data classification dimension to the data classification condition corresponding to the index, or dividing the target data classification dimension corresponding to the data classification condition into at least two sub-data classification dimensions; The stored business data and the newly added business data are stored in at least two of the indexes respectively, and the data classification conditions corresponding to at least two of the indexes include the newly added data classification dimension or the sub-data classification dimension; Receive a business data query request, wherein the business data query request includes a data query condition corresponding to the target business data; Determine, according to the data query condition, a dimension value corresponding to each data query dimension, wherein the data query dimension corresponding to the data query condition is the same as the data classification dimension corresponding to the data classification condition; Determine the target index name according to the dimension value corresponding to each of the data query dimensions; Determine a target index from at least one of the indexes according to the target index name, wherein the data classification condition corresponding to the target index meets the data query condition; The target business data is searched from the target data slice corresponding to the target index.

2. The method according to claim 1, characterized in that The business server is also provided with a MySQL relational database management system, and the MySQL stores the same business data as the ES; After searching the target business data from the target data slice corresponding to the target index, the method further includes: In response to a service data update request for the target service data, obtaining a data identifier corresponding to the target service data; Update the target business data stored in the MySQL according to the data identifier; In response to the target business data in the MySQL being updated, the target business data in the target index is updated according to the updated target business data.

3. The method according to claim 2, characterized in that The business data query request is a product order query request, and the business data update request is triggered when a target product order corresponding to the product order query request is queried; After searching the target business data from the target data slice corresponding to the target index, the method further includes: In response to finding the target product order corresponding to the product order query request, obtaining an order identifier corresponding to the target product order; Update the order status corresponding to the target product order in the MySQL according to the order identifier, wherein the order status includes at least one of an order-accepted state and an order-unaccepted state; In response to completion of updating the order status corresponding to the target product order in the MySQL, the order status corresponding to the target product order in the target index is updated according to the updated order status.

4. A business data query device, characterized in that: The device is applied to a business server running an ES, the ES includes at least one index, each of the indexes corresponds to a single data shard, the data shard is used to store business data, the data shard has a maximum data storage capacity, and the device includes: A second determination module is configured to, in response to the data volume of the business data corresponding to the candidate data classification dimension being greater than the maximum data storage volume, add a data classification dimension based on the candidate data classification dimension, or divide the candidate data classification dimension into at least two sub-data classification dimensions to obtain a target data classification dimension; The second determining module is further configured to determine the candidate data classification dimension as the target data classification dimension in response to the data volume of the business data corresponding to the candidate data classification dimension being less than the maximum data storage volume; A third determination module, used to determine the data classification condition corresponding to the business data according to the dimension value corresponding to the target data classification dimension; a fourth determination module, configured to determine at least one index name corresponding to the business data according to the data classification condition; a first storage module, configured to store the business data in the index corresponding to at least one index name, wherein different indexes store the business data meeting different data classification conditions; A second receiving module is used to receive a data addition request for the service data stored in the index, and obtain the data volume of the newly added service data corresponding to the data addition request; A fifth determination module, configured to determine a total data volume corresponding to the index according to the data volume of the newly added business data and the data volume of the stored business data; a sixth determining module, configured to, in response to the total data volume being greater than the maximum data storage volume, add a data classification dimension to the data classification condition corresponding to the index, or divide the target data classification dimension corresponding to the data classification condition into at least two sub-data classification dimensions; A second storage module is used to store the stored business data and the newly added business data in at least two of the indexes respectively, and the data classification conditions corresponding to at least two of the indexes include the newly added data classification dimension or the sub-data classification dimension; A first receiving module, configured to receive a business data query request, wherein the business data query request includes a data query condition corresponding to target business data; A first determining module, configured to determine a dimension value corresponding to each data query dimension according to the data query condition, wherein the data query dimension corresponding to the data query condition is the same as the data classification dimension corresponding to the data classification condition; The first determination module is further used to determine the target index name according to the dimension value corresponding to each of the data query dimensions; The first determination module is further configured to determine a target index from at least one of the indexes according to the target index name, wherein the data classification condition corresponding to the target index meets the data query condition; A search module is used to search for the target business data from the target data slice corresponding to the target index.

5. A server, characterized in that: The server includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the business data query method according to any one of claims 1 to 3.

6. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the business data query method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Data updating method and device, and electronic equipment

    CN106960007A

  • Index allocation method and device for improving performance of ES-based log system

    CN110990366A

  • ElasticSearch-based data indexing method and device, computer equipment and storage medium

    CN111797096A