CN112181993A - Service data query method, device, server and storage medium - Google Patents

Service data query method, device, server and storage medium Download PDF

Info

Publication number
CN112181993A
CN112181993A CN202011168056.XA CN202011168056A CN112181993A CN 112181993 A CN112181993 A CN 112181993A CN 202011168056 A CN202011168056 A CN 202011168056A CN 112181993 A CN112181993 A CN 112181993A
Authority
CN
China
Prior art keywords
data
target
index
service data
query
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011168056.XA
Other languages
Chinese (zh)
Inventor
姚灵芝
刘智杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Wangxing Information Technology Co Ltd
Original Assignee
Guangzhou Wangxing Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Wangxing Information Technology Co Ltd filed Critical Guangzhou Wangxing Information Technology Co Ltd
Priority to CN202011168056.XA priority Critical patent/CN112181993A/en
Publication of CN112181993A publication Critical patent/CN112181993A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a business data query method, a business data query device, a server and a storage medium. The method is applied to a service server running an ES open source distributed search engine, wherein the ES comprises at least one index, the index corresponds to a data fragment, and the data fragment is used for storing service data, and the method comprises the following steps: receiving a service data query request, wherein the service data query request comprises a data query condition corresponding to target service data; determining a target index from at least one index according to the data query condition, 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; and searching target service data from the target data fragment corresponding to the target index. The data query processes such as broadcasting the data query request to the plurality of data fragments and integrating the query results of the plurality of data fragments are avoided, and the data query efficiency is further improved.

Description

Service data query method, device, server and storage medium
Technical Field
The embodiment of the application relates to the technical field of internet, in particular to a business data query method, a business data query device, a server and a storage medium.
Background
In the business platform, it is usually necessary to face mass storage data, such as commodity data, order data, and the like, and in order to accurately query corresponding data, the query is generally performed in an index manner, for example, an index is performed according to a commodity name, so as to search corresponding commodity data.
In the related technology, the keyword corresponding to the commodity data or the order data can be used as an index word (index field), the service data matched with the keyword is searched from the database, the searched service data is subjected to relevance sequencing, and the most relevant service data is screened out and returned to the user.
Obviously, in the related art, a certain field is used as an index word, and all the service data stored in the database need to be queried and screened according to the field, which obviously reduces the query efficiency of the service data.
Disclosure of Invention
The embodiment of the application provides a business data query method, a business data query device, a server and a storage medium. The technical scheme is as follows:
in one aspect, an embodiment of the present application provides a method for querying service data, where the method is applied to a service server running an open source distributed Search Engine (ES), where the ES includes at least one index, where the index corresponds to one data slice, and the data slice is used to store service data, and the method includes:
receiving a service data query request, wherein the service data query request comprises a data query condition corresponding to target service data;
determining a target index from at least one index according to the data query condition, 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;
and searching the target service data from the target data fragment corresponding to the target index.
On the other hand, an embodiment of the present application provides a service data query apparatus, where the apparatus is applied to a service server running an ES, where the ES includes at least one index, the index corresponds to one data fragment, and the data fragment is used to store service data, and the apparatus includes:
the first receiving module is used for receiving a service data query request, wherein the service data query request comprises a data query condition corresponding to target service data;
the first determining module is used for determining a target index from at least one index according to the data query condition, 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;
and the searching module is used for searching the target service data from the target data fragment corresponding to the target index.
In another aspect, an embodiment of the present application provides a server, where the server includes a processor and a memory, where the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the service data query method according to the above aspect.
In another aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is loaded and executed by a processor to implement the service data query method according to the above aspect.
In another aspect, embodiments of the present application provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the server reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, so that the server executes the service data query method provided in the various alternative implementation modes of the above aspects.
The technical scheme provided by the embodiment of the application can bring the following beneficial effects:
by improving the ES, each index is set to store the service data with different data classification conditions, and each index only corresponds to one data fragment. When a business data query request is received, a target index consistent with the data query condition can be screened from a plurality of indexes based on the data query condition contained in the business data query request, data query does not need to be carried out on all indexes, and useless query operation can be reduced; searching target service data from a single data fragment corresponding to the target index, avoiding broadcasting a data query request to a plurality of data fragments and integrating query results of the plurality of data fragments, thereby reducing data query processes and further improving data query efficiency; in addition, since the different indexes store the service data with different data classification conditions, the data storage capacity of the data fragments corresponding to each index can be reduced, and the reduction of the data query rate caused by the large data volume of a single data fragment is avoided, so that the query efficiency of the service data is further improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating a data query process by an ES in the related art;
FIG. 2 illustrates a schematic structural diagram of an ES shown in an exemplary embodiment of the present application;
FIG. 3 illustrates a schematic diagram of an implementation environment provided by various embodiments of the present application;
FIG. 4 is a flowchart illustrating a business data query method provided by an exemplary embodiment of the present application;
FIG. 5 is a flow chart illustrating a business data storage method according to an exemplary embodiment of the present application;
FIG. 6 is a flow chart illustrating a business data storage method according to another exemplary embodiment of the present application;
FIG. 7 is a diagram illustrating a process for partitioning traffic data according to an exemplary embodiment of the present application;
FIG. 8 is a flowchart illustrating a business data query method according to another embodiment of the present application;
FIG. 9 is a flowchart illustrating a business data query method according to another embodiment of the present application;
FIG. 10 is a flowchart illustrating a business data query method according to another embodiment of the present application;
FIG. 11 is a diagram illustrating a user query order and pick up process in accordance with an illustrative embodiment of the present application;
fig. 12 is a block diagram illustrating a structure of a service data query device according to an embodiment of the present application;
fig. 13 shows a block diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
In the related art, an ES is generally used as a data query system, and based on an original ES structure, a data query process may be as shown in fig. 1, where an Index (Index) in the ES is composed of 2 data main fragments and 4 data sub-fragments, a data sub-fragment is a duplicate version of a data main fragment, and service data stored on the data sub-fragment is the same, where P1 and P2 represent the data main fragment corresponding to the Index, R1 and R2 represent the data sub-fragment corresponding to the Index, the ES further corresponds to multiple nodes (nodes), and each node stores two data fragments, so as to ensure data security, improve fault tolerance of the query system, and avoid a crash of a certain node, which may result in failure to perform data query.
In the data query phase, the ES mainly performs operations including:
1. the ES receives the data query request, and node1 becomes the coordinating node (corresponding to step 1 in fig. 1).
The coordinating node is used for broadcasting data query requests to other nodes or synthesizing data query results returned by other nodes.
2. node1 broadcasts a data query request to node2 and node3 (corresponding to step 2 in fig. 1).
Since it cannot be determined in which data slice the service data corresponding to the data query request is stored, the data query request needs to be broadcast to all data slices in the Index.
Wherein the coordinating node broadcasts a data query request to R1 in node2 and a data query request to P2 in node3 (all data slices in the design index).
3. After receiving the data query request, node2 and node3 return data query results to node1 (corresponding to step 3 and step 4 in fig. 1).
In response to the data query request receiving stage, node2 returns the data query result queried from data shard R1 to coordinating node1, and node3 returns the data query result queried from data shard P2 to coordinating node 1.
4. node1 integrates the data query results returned by node2 and node3 to obtain the document identification (docID) related to the data query condition.
Coordinating node1 integrates the data query results returned by node2 and node3, calculates the correlation between the query results and the query conditions, and screens out the most relevant document identification from the query results according to the correlation.
Since the general query purpose of the user is not to obtain the docID, but the document information corresponding to the docID, the fetching stage is also involved for obtaining the document information corresponding to the docID.
In the fetching phase, the ES mainly performs operations including:
5. node1 broadcasts an information acquisition request to node2 and node3 according to docID (corresponding to step 5 in fig. 1).
Wherein, the information acquisition request includes the docID.
The process of broadcasting the information acquisition request is similar to the process of broadcasting the data query request, and the information acquisition request needs to be broadcasted to other nodes (since the document is from different data fragments, the information acquisition request needs to be broadcasted to different data fragments in the index).
6. After receiving the document information acquisition request, node2 and node3 take out the document information corresponding to the docID from the data fragment and return the document information to coordinating node1 (corresponding to step 6 and step 7 in fig. 1).
7. After receiving all the returned document information, node1 returns the document information to the user (corresponding to step 8 in fig. 1).
Analyzing the above service data query process, it can be known that the whole data query process needs to pass through all data fragments on one Index, the coordinating node (node1) must broadcast the data query request of the user to all data fragments (or all nodes) in the Index, then comprehensively calculate the query results of all data fragments, and return the data most relevant to the query condition in all query results returned by each data fragment to the user.
Correspondingly, the whole data query process has two problems: firstly, the whole query process generates more useless operations, such as: broadcasting and integrating query results of all data fragments (because the storage position of the service data cannot be determined, a data query request needs to be broadcasted to all data fragments, and data needs to be fetched from all data fragments); and if more data fragments are contained in the Index, more useless operations are caused; and secondly, the coordination node needs to consume more power for synthesizing the query results of each data fragment (since the query result received by the node1 is a result fed back by a plurality of data fragments, the query result is the data most relevant to the query condition in each data fragment, and when the node1 synthesizes the query results of a plurality of data fragments, the query results need to be sorted and screened again according to the relevance of each query result and the query condition).
To solve the problems in the related art, an embodiment of the present application provides a new service data query method, which is implemented based on a new ES structure, and fig. 2 shows a schematic structural diagram of an ES shown in an exemplary embodiment of the present application. Firstly, in the embodiment of the application, before the service data is stored, the service data is classified in advance, and the service data is stored in different indexes according to different data classification conditions, so that the condition that all the service data are stored in the same Index is avoided, and the query speed is slow because the data volume of a single Index is too large; meanwhile, different from the situation that the indexes in the related technology correspond to a plurality of data fragments, in the embodiment of the application, a single data fragment is set for each Index in the ES, so that useless operation is avoided when the ES is inquired or updated. As shown in FIG. 2, the Index corresponds to only a single data master slice (P1), with duplicate versions of the data master slice (i.e., R1) stored in other nodes.
Based on the new ES structure, the query phase mainly comprises the following operations:
1. node1 receives a user's data query request.
The data query request comprises a data query condition.
2. node1 broadcasts a data query request to node 2.
Since only one data fragment corresponds to the Index, the service data stored in each node is the same, and thus, the data query request does not need to be broadcast to all data nodes, but only to a single node (the query on all data in the Index can be realized when a single data fragment is reached).
3. node2 returns the document identification associated with the data query request to node1 in accordance with the data query request.
Because only one data fragment is queried, the data fetching operation can be directly carried out in the node2 according to the document identification returned by the node2 without integrating and calculating the query results of a plurality of data fragments.
4. node1 broadcasts an information acquisition request to node2 based on the document identification returned by node 2.
Since the document identification is only from a single data fragment, the information acquisition request does not need to be broadcast to a plurality of nodes or data fragments, and the processing power consumption of the server can be further saved.
5. node2 returns the document information corresponding to the document identification to node 1.
6. The node1 returns the document information returned by the node2 to the user.
In the embodiment of the application, each Index only corresponds to a single data fragment by resetting the structure of the ES, so that useless broadcast data query operation is avoided in the data query process, and the operation of a plurality of data fragment query results is integrated, so that the query flow of the server is reduced, and the query efficiency is improved. In addition, in order to avoid storing more data volume on the data fragments in each Index, the service data is divided in advance according to the data classification conditions, so that the data volume stored on each data fragment meets the requirement of fast query, and the data query efficiency is further improved.
Based on the above-mentioned business data query method, fig. 3 shows a schematic diagram of an implementation environment provided by various embodiments of the present application. The implementation environment includes a terminal 301 and a server 302.
The terminal 301 is a device in which a data query application is installed. The data query application may be a search application (for querying browsing information), an order distribution application (for searching order information), and the like, and the terminal 301 may be a smartphone, a tablet computer, a PC, and the like. In this embodiment, taking an order distribution application as an example, a user may input a data query condition in a front-end interface of the application, and query and obtain some order information in a targeted manner, so that the corresponding terminal 301 carries the corresponding data query condition in the service data query request, so that the server 302 may search for corresponding target service data according to the data query condition.
The terminal 301 and the server 302 are connected by a wired or wireless network.
The server 302 is a background server or a business server corresponding to the data query application program. The server 302 is a device having functions of storing, querying, updating, and processing service data, and may be an independent physical server, or a server cluster or distributed system formed by a plurality of physical servers. In this embodiment, the server 302 runs the ES304, and can receive the service data query request sent by the terminal 301, locate the service data query request in the target index of the ES304 according to the data query condition included in the service query request, search for corresponding target service data from the target data fragment corresponding to the target index, and then feed back the target service data to the terminal 301. Optionally, the server 302 is further provided with a relational database management system (MySQL)303, where MySQL303 is used to store business data, and the ES304 is mainly responsible for business data query.
Referring to fig. 4, a flowchart of a service data query method provided in an exemplary embodiment of the present application is shown, where the embodiment of the present application takes the application of the method to the service server shown in fig. 3 as an example to explain, the method includes:
step 401, receiving a service data query request, where the service data query request includes a data query condition corresponding to target service data.
The service data query method shown in the embodiment of the present application is applied to the ES structure shown in fig. 2, that is, an ES includes at least one Index, and each Index corresponds to one data slice.
Optionally, the number of nodes included in each Index is not limited, and only the same data fragment is required to be stored in each node, which may be a data primary fragment or a data secondary fragment.
Aiming at the triggering scenario of the service data query request: the triggering of the user when the order distribution application program interface performs order query, the triggering of the user when the search interface performs data search, or the triggering of the business personnel when the business personnel counts certain types of business data may be performed, and the triggering scenario of the business data query request is not limited in the embodiment of the present application.
Different from the related art in which target service data is searched only according to Index words or key words, different from the method for searching target service data in different types of indexes, in the embodiment of the present application, a data query condition is added on the basis of the key words, so that the service server can accurately position the service data query request to the target Index based on the data query condition.
Wherein, the data query condition can be set based on the data classification conditions of different indexes in the ES.
Step 402, determining a target index from at least one index according to the data query condition, 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.
Since the index shown in the embodiment of the present application only corresponds to a single data fragment, in order to ensure data query efficiency, the data amount stored in the data fragment corresponding to each index cannot be excessive, and therefore, the service data needs to be classified so as to reduce the data amount of the service data stored in each data fragment, and correspondingly, the service data with different data classification conditions is stored in each index.
The data classification condition includes at least one data classification dimension, and the data classification dimension is set by service personnel according to different types of service data, for example, if the service data is commodity data, the corresponding data classification dimension may be: the commodity production place, the commodity production time, the commodity price and the like; if the service data is order data, the corresponding data classification dimension may be: the order distribution origin, the order distribution destination, the order distribution time, the order distribution mode, and the like, and the data classification dimension of the business data in the embodiment of the present application is not limited.
In order to correctly position the target index according to the data query condition in the data query process, avoid performing data query on all indexes in the ES, and improve the data query efficiency, in a possible implementation manner, 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.
When a user selects a data query dimension in an application program front-end interface for querying, a terminal determines a data query condition according to the data query dimension, and sends a service data query request containing the data query condition to a service server, and correspondingly, the service server determines a target index from a plurality of indexes according to the received data query condition and a data classification condition corresponding to each index in an ES (ES), and positions the data query request in the target index.
In an exemplary example, if the data query condition is that the order delivery time is 2020-10-01, which corresponds to the service data query dimension, and when the server receives the data query condition, a target index with data classification conditions of the order delivery time 2020-09-30 to 2020-10-03 (including the order data of 2020-10-01) is determined from the plurality of indexes, which corresponds to the service data query request, and the target index is located.
Step 403, searching the target service data from the target data fragment corresponding to the target index.
Different from the related art, each index includes a plurality of data fragments, when service data is queried in the index, as it cannot be predetermined in which data fragment the service data is stored, a data query request needs to be broadcast to the plurality of data fragments, and query results of the plurality of data fragments need to be synthesized, so that in the whole query process, more useless operations are generated (for example, some data fragments do not have target service data, but the data query request needs to be broadcast to the data fragments); and only the target service data returned by the target data fragment is acquired, and the query results of a plurality of data fragments are not required to be integrated, so that the processing amount of the server is further reduced, and the data query efficiency is improved.
To sum up, in the embodiment of the present application, by improving the ES, it is set that each index stores service data with different data classification conditions, and each index corresponds to only one data fragment. When a business data query request is received, a target index consistent with the data query condition can be screened from a plurality of indexes based on the data query condition contained in the business data query request, data query does not need to be carried out on all indexes, and useless query operation can be reduced; searching target service data from a single data fragment corresponding to the target index, avoiding broadcasting a data query request to a plurality of data fragments and integrating query results of the plurality of data fragments, thereby reducing data query processes and further improving data query efficiency; in addition, since the different indexes store the service data with different data classification conditions, the data storage capacity of the data fragments corresponding to each index can be reduced, and the reduction of the data query rate caused by the large data volume of a single data fragment is avoided, so that the query efficiency of the service data is further improved.
Since the service data query method provided by the embodiment of the application is implemented based on the new ES structure, in order to ensure efficient data query in the new ES structure, the process of storing service data according to the data classification condition is more important, and the guarantee of the data query efficiency can be achieved only by correctly dividing the stored data of each Index in the ES. The following embodiments will focus on how the service data is divided and stored in the ES.
Referring to fig. 5, a flowchart of a service data storage method according to an exemplary embodiment of the present application is shown, where the embodiment of the present application takes an example that the method is applied to the service server shown in fig. 3 as an example, and the method includes:
step 501, according to the service data, determining a target data classification dimension corresponding to the service data.
Because each index in the application only corresponds to a single data fragment, in order to avoid that the data query efficiency is affected by the fact that more data amount is stored in each data fragment, namely the data query efficiency and the data amount stored in the data fragment are in a negative correlation relationship, the data classification dimension of the business data needs to be determined in advance according to the business data, and therefore the data classification condition corresponding to each index is determined according to the data classification dimension.
The above embodiments can be referred to as a setting mode of the data classification dimension, and this embodiment is not described herein again.
Because there are more selectable data classification dimensions, specifically, the data is divided according to which data classification dimension or dimensions, in a possible implementation manner, in order to ensure data query efficiency, the data classification dimensions may be determined based on the magnitude of the service data and the maximum data storage amount corresponding to the data fragmentation.
On the basis of fig. 5, as shown in fig. 6, step 501 may include step 501A and step 501B.
Step 501A, in response to the fact that the data size of the service data corresponding to the candidate data classification dimension is larger than the maximum data storage amount, 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 subdata classification dimensions to obtain a target data classification dimension.
The maximum data storage amount is less than or equal to the data storage amount of a single data fragment, and the data storage amount can ensure that the data fragment has higher query efficiency when being queried.
For example, the maximum data storage amount is 40 GB.
In order to ensure data query efficiency, on the basis that different indexes correspond to different data classification conditions, it is required to ensure that the data volume of the service data corresponding to each data classification condition is smaller than the maximum data storage volume, and when determining a target data classification dimension, the relationship between the data volume corresponding to the target data classification dimension and the maximum data storage volume needs to be considered.
In a possible implementation manner, if the data volume of the service data corresponding to the candidate data classification dimension is greater than the maximum data storage amount, it indicates that if the service data is divided based on the candidate data classification dimension, there may be a large data volume corresponding to a certain class of service data, which affects data query efficiency, and more dimensions need to be divided for the class of service data.
In an exemplary example, a plurality of data classification dimensions are customized in advance, for example, a first data classification dimension, a second data classification dimension to an nth data classification dimension are customized in advance, the service data may be divided according to the first data classification dimension to obtain k types of service data, and a data amount corresponding to each type of service data is analyzed, if the data amount of at least one type of service data in the k types of service data is greater than a maximum data storage amount, the service data of the type having the data amount greater than the maximum data storage amount needs to be divided again, specifically, the service data of the type may be divided by using the second data classification dimension, or the first data classification dimension is divided into two first sub-data classification dimensions; correspondingly, the target data classification dimension at this time becomes "a first data classification dimension + a second data classification dimension" or "at least two first subdata classification dimensions", and similarly, if the data size of certain service data is larger after analysis after the division according to the target data classification dimension, the data dimension can be increased or the data dimension can be continuously divided more finely.
As shown in fig. 7, taking a first data dimension as a country dimension, a second data dimension as a time dimension, and a third data dimension as another dimension as an example, a schematic diagram of a business data partitioning process shown in an exemplary embodiment of the present application is shown. Firstly, dividing service data according to country dimensions, for example, the service data comes from country A, country B, country C and country D, firstly dividing the service data into four types of service data according to the four countries, analyzing the service data corresponding to different country dimensions, finding that the data volume of the service data corresponding to country D is large and is larger than the maximum data storage volume (data fragmentation), then continuously dividing the service data corresponding to country D, adopting a mode of increasing time dimensions, namely dividing the service data corresponding to country D according to the time dimensions, obtaining the service data corresponding to time period A, time period B, time period C and time period D respectively, if the service data corresponding to time period D is still large according to analysis, continuously increasing data dimensions, for example, other dimensions, namely dividing the service data corresponding to time period D according to other dimensions, and obtaining three types of service data, wherein the data volume of each type of service data is found to be more balanced and smaller than the maximum data storage volume, and the classification dimensionality of the target data corresponding to the obtained service data is 'national dimensionality + time dimensionality + other dimensionality'.
Step 501B, in response to the fact that the data volume of the service data corresponding to the candidate data classification dimension is smaller than the maximum data storage volume, determining the candidate data classification dimension as a target data classification dimension.
Similar to the above, when it is determined that the data size of the service data corresponding to the candidate data classification dimension is smaller than the maximum data storage amount, it indicates that a faster data query rate can be achieved after the service data is divided according to the candidate data classification dimension, and therefore, the candidate data classification dimension can be directly determined as the target data classification dimension.
Step 502, determining a data classification condition corresponding to the service data according to the dimension value corresponding to the classification dimension of the target data.
The dimension value corresponding to the data classification dimension indicates a common characteristic value of each type of service data after the service data are divided according to the data classification dimension, for example, the service data are divided according to the country dimension, and the common characteristic of each type of service data is a country name.
In a possible implementation manner, the data classification condition corresponding to each type of service data may be determined according to the dimension value corresponding to the target data classification dimension.
As shown in fig. 7, after the service data is divided according to the country dimensions, the service data corresponding to country a, country B, country C, and country D is obtained, the data classification condition corresponding to the service data stored in country C is country C, and the data classification condition corresponding to the service data corresponding to time slot C is country D + time slot C.
Step 503, determining at least one index name corresponding to the service data according to the data classification condition.
Because the business data corresponding to different data classification conditions are stored in different indexes, and the data query dimension corresponding to the data query condition is consistent with the data classification dimension, the business data can be accurately positioned in the index for storing the target business data according to the data query condition for convenience in follow-up, the data classification condition can be directly used as the index name of each index, and the follow-up data query process is facilitated.
In an exemplary example, for example, if a data classification condition corresponding to a certain index is country D + time period a, the corresponding index name may be "country D + time period a".
In one 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 in such a way that the data of each month is divided into three parts, the algorithm for calculating the Index name may be represented as:
Indexname=orderCountry+orderTime.Day%11
therein, IndexnameIndicating the index name, orderCountry indicating the country name corresponding to the order data, ordertime.day indicating the order time,% indicating the remainder, i.e., ordertime.day% 11 indicating the remainder of the order time divided by 11.
Step 504, storing the service data in an index corresponding to at least one index name.
In a possible implementation manner, after the service data have been divided into different categories according to the data classification conditions, different indexes can be set for the different data classification conditions, and the service data of the category can be stored in the corresponding index.
In another possible application scenario, on the basis that multiple indexes are created in the ES, if a new service data is subsequently required to be added, if the new service data is a new dimension value in a certain data dimension, a new index needs to be created for the new dimension value, for example, if an original country a to a country D in the country dimension, but the new service data corresponds to a country E, an index corresponding to the country E needs to be created first, and then the new service data is stored in the new index.
In this embodiment, the data classification dimensionality of the service data is determined by the data volume of the service data and the maximum data storage volume of the data shards, so that the data volume of the service data corresponding to each data classification condition can ensure faster data query efficiency, and the problem of data storage volume imbalance of different indexes in the ES can be avoided.
In another possible application scenario, if service data needs to be newly added to the created index, after the service data is newly added, the total amount of data corresponding to the newly added service data and the stored service data may be large, so that the data query efficiency corresponding to the index is affected, and therefore, when the service data is newly added, the factor of the maximum data storage amount of the data segment needs to be considered.
On the basis of fig. 5, as shown in fig. 6, after the service data is stored in the corresponding index according to the data classification condition, the method further includes steps 601 to 605.
Step 601, receiving a data adding request for the stored service data in the index, and acquiring the data volume of the newly added service data corresponding to the data adding request.
The present embodiment is a data storage process described for a scenario in which an index is created and part of service data is stored in the index.
In a possible implementation manner, when the service server receives the data addition request, and determines that the new service data should be stored in the created index according to the service data corresponding to the data addition request, in order to avoid that the data amount in the index is large (may exceed the maximum data storage amount) after the new service data is stored in the index, thereby reducing the data query rate, the data amount corresponding to the new service data needs to be obtained to determine whether the new service data can be directly stored in the index.
Step 602, determining a total data size corresponding to the index according to the data size of the newly added service data and the data size of the stored service data.
Wherein the stored service data is the service data stored in the index when a data addition request is received.
In a possible implementation manner, the data volume of the stored service data is obtained, the sum of the data volume of the stored service data and the data volume of the newly added service data is calculated, and the total data volume of the service data which is possible to reach after the newly added service data is added to the index is estimated.
In an exemplary example, if the data volume of the stored service data is 30GB and the data volume of the newly added service data is 20GB, it is estimated that 50GB of data may be stored in the data slice of the index after the service data is newly added to the index.
Step 603, in response to that the total data amount is greater than the maximum data storage amount, newly adding a data classification dimension in 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.
In a possible implementation manner, if the estimated total data amount exceeds the maximum data storage amount of the data fragment, in order to avoid that more data affects the data query efficiency, the service data corresponding to the index needs to be re-divided, and a specific implementation manner may be to newly add a data classification dimension in the data classification condition corresponding to the index, or to divide a target data classification dimension corresponding to the data classification condition into at least two sub-data classification dimensions.
In an exemplary example, if the total data size is 50GB, the maximum data storage amount of the data segments is 40GB, and the total data size is greater than the maximum data storage amount, if the newly added service data is continuously stored in the index, it obviously affects the data query rate of the index, and therefore, the newly added service data and the stored service data need to be re-divided.
For the dividing manner of the newly added service data and the stored service data, in a possible implementation manner, a data classification dimension may be newly added in the data classification condition, for example, the data classification condition corresponding to the index includes a first data classification dimension and a second data classification dimension, and in order to perform more detailed classification on the service data corresponding to the index, a third data classification dimension may be added to the data classification condition, that is, the data classification condition is changed to "the first data classification dimension + the second data classification dimension + the third data classification dimension".
In an exemplary example, if the index corresponds to the stored service data corresponding to country a, and after the service data is newly added in the index, the data volume of the service data corresponding to country a exceeds the maximum data storage amount, a city dimension may be newly added in the data classification condition, that is, the service data corresponding to country a is divided again according to different cities, and the obtained data classification condition includes "country a + city X".
Optionally, a data classification dimension in the data classification condition corresponding to the index may also be divided into at least two sub-data classification dimensions, for example, if the data classification condition corresponds to a time dimension, where the time dimension is data-divided according to each month, and if the service data corresponding to a certain month exceeds the maximum data storage amount, a certain month is divided into three parts in the time dimension based on the monthly division, that is, the target time dimension is divided into at least two sub-data dimensions (at least two sub-time periods).
In an exemplary example, if the index stores service data for 3 months correspondingly, and after analyzing the newly added service data in the index, the data size of the service data for 3 months exceeds the maximum data storage amount, the time dimension for 3 months may be divided into at least two sub-data classification dimensions, for example, service data divided into three time periods, that is, three time periods of nos. 1 to 10, 11 to 20, and 21 to 30.
Step 604, the stored service data and the newly added service data are respectively stored in at least two indexes, 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.
In a possible implementation manner, after the service data corresponding to the index is divided, a new data classification condition is generated correspondingly, based on the principle that different data classification conditions correspond to different indexes, a new index is created for the new data classification condition, the stored service data and the newly added service data are divided again according to the new data classification condition, and the stored service data and the newly added service data are stored in the corresponding new index according to the corresponding data classification condition.
In an exemplary example, after the service data corresponding to the index (stored service data + new service data) is re-divided, if the data classification condition corresponding to the original index is country a, and after the data classification condition corresponding to the service data is re-divided, the data classification condition corresponding to the service data is changed into "country a + city a", "country a + city B", and "country a + city C", it is necessary to create an index name and an index for the new data classification condition, and store the stored service data and the new service data in the indexes corresponding to "country a + city a", "country a + city B", and "country a + city C", respectively.
In another possible application scenario, if the sum (total data amount) of the data amount of the newly added service data and the data amount of the stored service data is less than the maximum data storage amount, the newly added service data may be directly stored in the index.
In this embodiment, the storage mode of the newly added service data is determined by comparing the relationship between the total data volume of the newly added service data and the stored service data and the maximum data storage volume, so that the data volume in the index exceeds the maximum data volume threshold after the service data is newly added in a certain index, thereby affecting the data query efficiency and further improving the data query efficiency.
The foregoing embodiment describes a process of storing service data, and when storing service data, a corresponding index is first set for the service data based on a data classification condition of the service data, so that in a data query process, a data query request can be directly located to a target index that meets the data query condition based on the data query condition, so as to avoid searching for other indexes without the service data, and further improve data query efficiency.
Referring to fig. 8, a flowchart of a service data query method according to another embodiment of the present application is shown, where the embodiment of the present application takes the application of the method to the service server shown in fig. 3 as an example to explain, the method includes:
step 801, receiving a service data query request, where the service data query request includes a data query condition corresponding to target service data.
And if the data query dimension corresponding to the data query condition is consistent with the data classification dimension corresponding to the data classification condition, the data query dimension corresponding to the data query condition can be set by integrating the data classification dimensions of each index after the business data is stored in the index.
In an exemplary example, for example, if the data classification dimension includes a country dimension, a city dimension, a time dimension, etc., then the corresponding data query dimension also includes: country dimension, city dimension, time dimension, and the like.
For example, if the user selects a country dimension in the front-end interface of the application program and selects a country a therein, the corresponding data query condition is country a.
Step 802, determining a dimension value corresponding to each data query dimension according to the data query condition.
In a possible implementation manner, after the server receives a data query request including a data query condition, a data query dimension indicated by the data query condition and a dimension value corresponding to the data query dimension are obtained.
In an exemplary example, if the user needs to query the service data corresponding to city C in country B, the service data query request includes the following data query conditions: the service server determines that the data query condition corresponds to two data query dimensions, namely a country dimension and a city dimension, according to the data query condition, wherein the dimension value corresponding to each data query dimension is as follows: the dimension value corresponding to the country dimension is country B, and the dimension value corresponding to the city dimension is city C.
Step 803, determining the name of the target index according to the dimension value corresponding to each data query dimension.
Since the data query dimension and the data classification dimension are consistent, and the index name corresponds to the data classification condition, in one possible implementation, the target index name indicated by the data query condition may be determined from the created plurality of index names based on the dimension value corresponding to each data query dimension.
In a possible implementation manner, 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 service data query request corresponds to a single target index.
For example, if the data query condition is country B, that is, the user needs to query the service data of country B, and the index name has exactly the target index name of country B, the target index corresponding to country B is the index corresponding to the service data query request.
Optionally, if there is no index name that is identical to the dimension value corresponding to the data query dimension and there is an index name that includes the dimension value, at least one index name that includes the dimension value may be determined as the target index name.
For example, if the data query condition is country D, and the index names include "country D + city a" and "country D + city B" and "country D + city C", which indicate that the service data of country D is divided into three categories, the three index names are correspondingly determined as the target index names.
And step 804, determining a target index from at least one index according to the target index name.
Because the index name and the index have the unique corresponding relation, the target index corresponding to the data query request can be determined from at least one index in the ES directly according to the determined at least one target index name, and the service data query request is positioned to the target index.
Step 805, searching the target service data from the target data fragment corresponding to the target index.
The implementation manner of this step may refer to the above embodiments, which are not described herein.
In this embodiment, a process of determining a target index according to a data query condition is described, and a target index name corresponding to a service data query request is determined by analyzing each data query dimension contained in the data query condition and a dimension value corresponding to each data query dimension and based on a corresponding relationship between a data classification dimension and the data query dimension, so that the target index name is favorably and quickly located in the target index containing target service data, a service data query request is prevented from being initiated to all indexes, and a query rate of the service data is improved.
In the related technology, a service server is generally provided with MySQL for storing service data, an ES is generally responsible for service data query, when service data is updated, the service data in MySQL is generally updated first, and because the ES has data update delay, that is, the service data in the ES generally does not have the capability of timely sensing data update, the service data in the ES is generally refreshed at intervals of a preset time period, for example, the service data in the ES is refreshed at intervals of 3min, obviously, real-time update of the service data cannot be achieved, if the service data in MySQL updates some service data at the time of 10:10:30, at this time, the ES cannot sense that the service data is updated, and after a refresh operation is executed after 3min, the service data in MySQL is updated according to the service data, obviously, in 3min after MySQL updates the service data, the service data in the ES still maintains the state before updating, and within this 3min, the user may not find the updated service data in the ES, or the service data acquired by the user is inconsistent with the service data in MySQL, thereby affecting the query accuracy of the service data. Therefore, in a possible implementation mode, a data write-back MySQL mode is adopted to realize timely update of business data in the ES, and consistency of MySQL and data in the ES is guaranteed.
In an exemplary example, as shown in fig. 9, a flowchart of a service data query method provided in another embodiment of the present application is shown, where the embodiment of the present application is described by taking an example that the method is applied to a service server shown in fig. 3, and the method includes:
step 901, receiving a service data query request, where the service data query request includes a data query condition corresponding to target service data.
Step 902, determining a target index from at least one index according to the data query conditions, wherein different indexes correspond to different data classification conditions, and the data query dimensions corresponding to the data query conditions are the same as the data classification dimensions corresponding to the data classification conditions.
Step 903, searching the target service data from the target data fragment corresponding to the target index.
Step 904, responding to the service data update request of the target service data, and acquiring a data identifier corresponding to the target service data.
Wherein, the service data updating request is triggered after the target service data is found.
For the scene that the service data updating request is triggered after the target service data is found, the service personnel needs to update the target service data, firstly, the target service data is found from the ES, the data identifier corresponding to the target service data is obtained, and then the target service data is correspondingly updated in MySQL according to the data identifier corresponding to the target service data; or some special types of target business data, such as a commodity order, when a user needs to receive an order, the user first screens out a target commodity order according to order screening conditions, that is, the user determines to take over the target commodity order, and then the order state of the target commodity order is triggered to be updated, for example, the order missed state is updated to the order received state. The embodiment of the present application does not limit the scenario for triggering the service data update request.
The data identification is the only identification of the target service data in MySQL, and is set for the target service data by service personnel.
Step 905, updating the target service data stored in MySQL according to the data identifier.
Because the data storage structure in MySQL is not the same as the data storage structure in ES, and MySQL provides a function of searching for target service data according to the data identifier, in a possible implementation, when it is sensed that the target service data may be updated, the target service data stored in MySQL may be searched for according to the data identifier and updated correspondingly.
Step 906, in response to the completion of the updating of the target service data in MySQL, updating the target service data in the target index according to the updated target service data.
Since data consistency needs to be guaranteed in MySQL and ES, and in the related art, the consistency of service data is generally maintained by performing refresh operation every other preset time period, which may cause that update in the preset time period cannot be timely updated to the ES, that is, the time when the service data in MySQL is updated but the service data in the ES is not updated, in the embodiment of the present application, after sensing that the update of the target service data in MySQL is completed, the target service data in the target index is immediately updated according to the updated target service data, so that the condition that the service data in MySQL and the ES are inconsistent is avoided.
In this embodiment, MySQL is associated with the ES, so that after receiving a service data update request, the service data in MySQL is updated first, and then the service data in the ES is updated immediately according to the service data in MySQL, thereby avoiding a situation that the service data in the ES is inconsistent with the service data in MySQL due to the regular refreshing of the service data in the ES, and improving the accuracy of the service data queried by the user.
The foregoing embodiment describes an update process of service data, and this embodiment describes a process in which a user queries an order and receives an order by taking an example in which the service data update process is applied to an order distribution scenario.
In an exemplary example, as shown in fig. 10, a flowchart of a service data query method provided in another embodiment of the present application is shown, where the embodiment of the present application is described by taking an example that the method is applied to a service server shown in fig. 3, and the method includes:
step 1001, receiving a commodity order query request, where the commodity order query request includes a data query condition corresponding to a target commodity order.
Taking an order distribution scenario as an example, in the related art, the order distribution system mainly has a mode of dispatching orders and grabbing orders, and generally, a server side dispatches a proper order to a proper user on the basis of researching and analyzing a large amount of user behaviors, and if the user behaviors or preferences change, a server side cannot immediately adjust an order dispatching strategy, which may cause a situation that a user refuses to take orders after the order dispatching, thereby affecting the efficiency of order distribution.
Aiming at the problems in the related art, the business data query method in the application is applied to an order distribution scene, from the perspective of a user, the user can perform order screening on a front-end interface of an application program, a corresponding terminal can send a commodity order query request to a business server, and the commodity order query request can carry order query conditions (data query conditions) input by the user, so that the business server can distribute commodity orders meeting the requirements of the user for the user, the situation of unmanned order taking is avoided, and the order distribution efficiency is improved.
Step 1002, determining a target index from at least one index according to the data query condition, 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.
The implementation manner of this step may refer to the above embodiments, which are not described herein.
Step 1003, searching the target commodity order from the target data fragment corresponding to the target index.
For the order distribution scene, the service data correspondingly stored in the ES is the commodity order data, and correspondingly, after the target commodity order corresponding to the order query condition is found from the target index, the target commodity order is returned to the terminal (user client).
Step 1004, in response to the target commodity order corresponding to the commodity order query request, obtaining an order identifier corresponding to the target commodity order.
In order to further improve the distribution efficiency of the commodity orders, the target commodity orders searched by the user are acquiescent to be the commodity orders accepted by the user, that is, if the ES returns the target commodity orders, the order states of the target commodity orders are changed by default, for example, the order states of the target commodity orders in MySQL and the ES need to be updated correspondingly when the order state is changed from the non-order-receiving state to the order-receiving state, so that the data updating request for the target commodity orders is determined to be received by default after the target commodity orders are searched, and the order states of the target commodity orders are used for updating subsequently by obtaining the order identifications corresponding to the target commodity orders.
Optionally, after the service server returns the searched target commodity order to the user client, the user may check the target commodity order in the front-end interface of the application program, and for the returned target commodity order, the user may select one or more target commodity orders from the target commodity order, and the corresponding service server receives a selection operation on the target commodity order, which indicates that the user determines to accept the target commodity order, and is used for subsequently updating the order state of the commodity order by obtaining the order identifier of the target commodity order.
And step 1005, updating the order state corresponding to the target commodity order in MySQL according to the order identifier.
The order status may be a received order status, a missed order status, a delivery status, and the like, which is not limited in this embodiment of the present application.
According to the method and the device for ordering the target commodity orders, order inquiring operation of the user and order taking operation of the user are associated, the default user finds the target commodity orders, namely the target commodity orders need to be taken, the order state corresponding to the target commodity orders is changed from the order missing state to the order taking state, and at the moment, the order state corresponding to the target commodity orders in MySQL needs to be updated firstly according to order identification.
Step 1006, in response to the completion of the updating of the order state corresponding to the target commodity order in MySQL, updating the order state corresponding to the target commodity order in the target index according to the updated order state.
In order to ensure consistency of business data in MySQL and ES, the order state in MySQL is prevented from being updated to a pick-up state, but the order state in ES is still in a non-pick-up state, so that the situation that other users return a pick-up order to the users when querying a commodity order which is not picked up occurs, and error in order query and subsequent pick-up is caused.
In another possible application scenario, after the updating of the order state in MySQL is completed, the user successfully receives the order, and the order updating result is returned to the user client.
In the embodiment, by taking an order distribution scene as an example, the order query of the user and the order distribution are associated, and when the user initiates an order query request to the service server, the service server correspondingly distributes the commodity orders meeting the order query condition to the user, so that the order distribution efficiency is improved.
Referring to fig. 11, a schematic diagram of a process for a user to query an order and pick up an order is shown in an exemplary embodiment of the present application. When a user inputs order query conditions on a front-end interface of an order distribution application program, a corresponding terminal sends an order query request containing the order query conditions to a request preprocessing module 1101 in a service server, determines a target index name according to the order query conditions in the request preprocessing module 1101, sends the target index name to an ES request processing module 1102, locates the order query request to a target index (namely index 1) corresponding to the target index name in an ES1105 by the ES request processing module 1102, searches order data information corresponding to the order query request in the index 1, returns the order data information to the ES request processing module 1102, and sends an order status information update request containing an order identifier corresponding to the order data information to MySQL1104 through the MySQL request processing module 1103 by the ES request processing module 1102, MySQL1104 updates the order state information according to the order identifier (for example, the order state is updated from a missed order state to a received order state), and after the order state information in MySQL1104 is updated, the order state information is synchronized to index 1 of ES1105 through a service data synchronization module 1106; meanwhile, MySQL1104 feeds back the update result of the order state information to the user, which indicates that the user successfully accepts the order.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 12, a block diagram of a service data query device according to an embodiment of the present application is shown. The device has the functions of implementing the method embodiments, and the functions can be realized by hardware or by hardware executing corresponding software. As shown in fig. 12, the apparatus may include:
a first receiving module 1201, configured to receive a service data query request, where the service data query request includes a data query condition corresponding to target service data;
a first determining module 1202, configured to determine a target index from at least one of the indexes according to the data query condition, where 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;
a searching module 1203, configured to search the target service data from the target data segment corresponding to the target index.
Optionally, the first determining module 1202 includes:
the first determining unit is used for determining a dimension value corresponding to each data query dimension according to the data query condition;
the second determining unit is used for determining a target index name according to the dimension value corresponding to each data query dimension;
a third determining unit, configured to determine the target index from at least one of the indexes according to the target index name.
Optionally, the apparatus further comprises:
the second determining module is used for determining a target data classification dimension corresponding to the business data according to the business data;
a third determining module, configured to determine the data classification condition corresponding to the service data according to a dimension value corresponding to the target data classification dimension;
a fourth determining module, configured to determine, according to the data classification condition, at least one index name corresponding to the service data;
the first storage module is configured to store the service data in the index corresponding to at least one of the index names.
Optionally, the data slice has a maximum data storage amount;
the second determining module includes:
a fourth determining unit, configured to, in response to that a data amount of the service data corresponding to a candidate data classification dimension is greater than the maximum data storage amount, add a new 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;
a fifth determining unit, configured to determine, in response to that the data amount of the service data corresponding to the candidate data classification dimension is smaller than the maximum data storage amount, the candidate data classification dimension as the target data classification dimension.
Optionally, the apparatus further comprises:
a second receiving module, configured to receive a data addition request for service data stored in the index, and obtain a data amount of newly added service data corresponding to the data addition request;
a fifth determining module, configured to determine, according to the data amount of the newly added service data and the data amount of the stored service data, a total data amount corresponding to the index;
a sixth determining module, configured to, in response to that the total data amount is greater than the maximum data storage amount, newly 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;
and the second storage module is used for respectively storing the stored service data and the newly added service data in at least two indexes, and the data classification conditions corresponding to the at least two indexes comprise newly added data classification dimensions or the sub-data classification dimensions.
Optionally, a MySQL relational database management system is further disposed in the service server, and the same service data is stored in the MySQL and the ES;
the device further comprises:
the first obtaining module is used for responding to a service data updating request of the target service data and obtaining a data identifier corresponding to the target service data;
the first updating module is used for updating the target business data stored in the MySQL according to the data identifier;
and the second updating module is used for responding to the completion of the updating of the target service data in the MySQL and updating the target service data in the target index according to the updated target service data.
Optionally, the service data query request is a commodity order query request, and the service data update request is triggered when a target commodity order corresponding to the commodity order query request is queried;
the device further comprises:
the second obtaining module is used for responding to the target commodity order corresponding to the commodity order query request and obtaining an order identifier corresponding to the target commodity order;
a third updating module, configured to update an order state corresponding to the target commodity order in the MySQL according to the order identifier, where the order state includes at least one of an order-accepted state and an order-missed state;
and the fourth updating module is used for responding to the completion of the updating of the order state corresponding to the target commodity order in the MySQL, and updating the order state corresponding to the target commodity order in the target index according to the updated order state.
To sum up, in the embodiment of the present application, by improving the ES, it is set that each index stores service data with different data classification conditions, and each index corresponds to only one data fragment. When a business data query request is received, a target index consistent with the data query condition can be screened from a plurality of indexes based on the data query condition contained in the business data query request, data query does not need to be carried out on all indexes, and useless query operation can be reduced; searching target service data from a single data fragment corresponding to the target index, avoiding broadcasting a data query request to a plurality of data fragments and integrating query results of the plurality of data fragments, thereby reducing data query processes and further improving data query efficiency; in addition, since the different indexes store the service data with different data classification conditions, the data storage capacity of the data fragments corresponding to each index can be reduced, and the reduction of the data query rate caused by the large data volume of a single data fragment is avoided, so that the query efficiency of the service data is further improved.
It should be noted that: in the above embodiment, when the device implements the functions thereof, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
Referring to fig. 13, a block diagram of a server according to an embodiment of the present application is shown. The server may be configured to implement the service data query method provided in the foregoing embodiment. Specifically, the method comprises the following steps:
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 CPU 1301. The server 1300 also includes a basic Input/Output system (I/O system) 1306, which facilitates transfer of information between devices within the server, and a mass storage device 1307 for storing an operating system 1313, application programs 1314, and other program modules 1315.
The basic input/output system 1306 includes a display 1308 for displaying information and an input device 1309, such as a mouse, keyboard, etc., for a user to input information. Wherein the display 1308 and 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 input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input-output controller 1310 also provides output to a display screen, a printer, or other type of output device.
The mass storage device 1307 is connected to the central processing unit 1301 through a mass storage controller (not shown) connected to the system bus 1305. The mass storage device 1307 and its associated computer-readable storage media 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 Compact Disc-Only Memory (CD-ROM) drive.
Without loss of generality, the computer-readable storage media may include computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable storage instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), flash Memory or other solid state Memory technology, CD-ROM, Digital Versatile Disks (DVD), or other optical, magnetic, or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the foregoing. The system memory 1304 and mass storage device 1307 described above may be collectively referred to as memory.
The memory stores one or more programs configured to be executed by the one or more central processing units 1301, the one or more programs containing instructions for implementing the method embodiments described above, and the central processing unit 1301 executes the one or more programs to implement the service data query method provided by the various method embodiments described above.
The server 1300 may also operate as a remote server connected to a network via a network, such as the internet, according to various embodiments of the present application. That is, the server 1300 may be connected to the network 1312 through the network interface unit 1311, which is connected to the system bus 1305, or may be connected to other types of networks or remote server systems (not shown) using the network interface unit 1311.
The memory also includes one or more programs, which are stored in the memory, and the one or more programs include instructions for performing the steps performed by the service server in the method provided by the embodiment of the present application.
The embodiment of the present application further provides a computer-readable storage medium, where at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is loaded and executed by the processor to implement the service data query method according to the above embodiments.
According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being stored in a computer readable storage medium. The processor of the server reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, so that the server executes the service data query method provided in the various alternative implementation modes of the above aspects.
It should be understood that reference to "a plurality" herein means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. In addition, the step numbers described herein only exemplarily show one possible execution sequence among the steps, and in some other embodiments, the steps may also be executed out of the numbering sequence, for example, two steps with different numbers are executed simultaneously, or two steps with different numbers are executed in a reverse order to the order shown in the figure, which is not limited by the embodiment of the present application.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. A service data query method is applied to a service server running an ES open source distributed search engine, wherein the ES comprises at least one index, the index corresponds to a data fragment, and the data fragment is used for storing service data, and the method comprises the following steps:
receiving a service data query request, wherein the service data query request comprises a data query condition corresponding to target service data;
determining a target index from at least one index according to the data query condition, 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;
and searching the target service data from the target data fragment corresponding to the target index.
2. The method of claim 1, wherein determining a target index from at least one of the indexes according to the data query comprises:
determining a dimension value corresponding to each data query dimension according to the data query condition;
determining a target index name according to the dimension value corresponding to each data query dimension;
and determining the target index from at least one index according to the target index name.
3. The method of claim 2, wherein before receiving the service data query request, the method further comprises:
determining a target data classification dimension corresponding to the business data according to the business data;
determining the data classification condition corresponding to the service data according to the dimension value corresponding to the classification dimension of the target data;
determining at least one index name corresponding to the service data according to the data classification condition;
and storing the service data in the index corresponding to at least one index name.
4. The method of claim 3, wherein the data slice has a maximum amount of data storage;
the determining the classification dimension of the target data corresponding to the business data according to the business data comprises the following steps:
responding to the fact that the data volume of the service data corresponding to the candidate data classification dimension is larger than the maximum data storage volume, newly adding the 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 the target data classification dimension;
and determining the candidate data classification dimension as the target data classification dimension in response to the data volume of the service data corresponding to the candidate data classification dimension being smaller than the maximum data storage volume.
5. The method of claim 4, wherein after storing the service data in the index corresponding to at least one of the index names, the method further comprises:
receiving a data adding request for the stored service data in the index, and acquiring the data volume of newly added service data corresponding to the data adding request;
determining the total data volume corresponding to the index according to the data volume of the newly added service data and the data volume of the stored service data;
in response to that the total data volume is larger than the maximum data storage volume, newly adding a data classification dimension in 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;
and respectively storing the stored service data and the newly added service data in at least two indexes, wherein the data classification conditions corresponding to the at least two indexes comprise newly added data classification dimensions or the sub-data classification dimensions.
6. The method according to any one of claims 1 to 5, wherein a MySQL relational database management system is further provided in the service server, and the MySQL and the ES store the same service data;
after the target service data is searched for from the target data fragment corresponding to the target index, the method further includes:
responding to a service data updating request of the target service data, and acquiring a data identifier corresponding to the target service data;
updating the target business data stored in the MySQL according to the data identification;
and in response to the completion of the updating of the target service data in the MySQL, updating the target service data in the target index according to the updated target service data.
7. The method according to claim 6, wherein the service data query request is a commodity order query request, and the service data update request is triggered when a target commodity order corresponding to the commodity order query request is queried;
after the target service data is searched for from the target data fragment corresponding to the target index, the method further includes:
responding to the target commodity order corresponding to the commodity order query request, and acquiring an order identification corresponding to the target commodity order;
updating an order state corresponding to the target commodity order in the MySQL according to the order identifier, wherein the order state comprises at least one of an order receiving state and an order missing state;
and in response to the completion of the updating of the order state corresponding to the target commodity order in the MySQL, updating the order state corresponding to the target commodity order in the target index according to the updated order state.
8. A service data query apparatus, where the apparatus is applied to a service server running an ES, where the ES includes at least one index, and the index corresponds to a data slice, and the data slice is used to store service data, and the apparatus includes:
the first receiving module is used for receiving a service data query request, wherein the service data query request comprises a data query condition corresponding to target service data;
the first determining module is used for determining a target index from at least one index according to the data query condition, 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;
and the searching module is used for searching the target service data from the target data fragment corresponding to the target index.
9. A server, characterized in that the server comprises 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 service data query method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the business data query method according to any one of claims 1 to 7.
CN202011168056.XA 2020-10-27 2020-10-27 Service data query method, device, server and storage medium Pending CN112181993A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011168056.XA CN112181993A (en) 2020-10-27 2020-10-27 Service data query method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011168056.XA CN112181993A (en) 2020-10-27 2020-10-27 Service data query method, device, server and storage medium

Publications (1)

Publication Number Publication Date
CN112181993A true CN112181993A (en) 2021-01-05

Family

ID=73923287

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011168056.XA Pending CN112181993A (en) 2020-10-27 2020-10-27 Service data query method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN112181993A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112749166A (en) * 2021-01-15 2021-05-04 京东数字科技控股股份有限公司 Service data processing method, device, equipment and storage medium
CN112883243A (en) * 2021-01-25 2021-06-01 上海德启信息科技有限公司 Data query method and device, electronic equipment and storage medium
CN113268487A (en) * 2021-06-16 2021-08-17 中移(杭州)信息技术有限公司 Data statistical method, device and computer readable storage medium
CN113836186A (en) * 2021-09-28 2021-12-24 北京环境特性研究所 Simulation data query method and device based on ES search engine
CN116089437A (en) * 2022-11-30 2023-05-09 荣耀终端有限公司 Data processing method and server
CN117112618A (en) * 2023-10-25 2023-11-24 上海合见工业软件集团有限公司 EDA software data query method, electronic device and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106960007A (en) * 2017-02-28 2017-07-18 北京京东尚科信息技术有限公司 A kind of data-updating method, device and electronic equipment
CN107016025A (en) * 2016-11-17 2017-08-04 阿里巴巴集团控股有限公司 A kind of method for building up and device of non-relational database index
CN108509437A (en) * 2017-02-24 2018-09-07 南京烽火星空通信发展有限公司 A kind of ElasticSearch inquiries accelerated method
CN110990366A (en) * 2019-12-04 2020-04-10 中国农业银行股份有限公司 Index allocation method and device for improving performance of log system based on ES
CN111460023A (en) * 2020-04-29 2020-07-28 上海东普信息科技有限公司 Service data processing method, device, equipment and storage medium based on elastic search
CN111797096A (en) * 2020-06-29 2020-10-20 中国平安财产保险股份有限公司 Data indexing method and device based on ElasticSearch, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107016025A (en) * 2016-11-17 2017-08-04 阿里巴巴集团控股有限公司 A kind of method for building up and device of non-relational database index
CN108509437A (en) * 2017-02-24 2018-09-07 南京烽火星空通信发展有限公司 A kind of ElasticSearch inquiries accelerated method
CN106960007A (en) * 2017-02-28 2017-07-18 北京京东尚科信息技术有限公司 A kind of data-updating method, device and electronic equipment
CN110990366A (en) * 2019-12-04 2020-04-10 中国农业银行股份有限公司 Index allocation method and device for improving performance of log system based on ES
CN111460023A (en) * 2020-04-29 2020-07-28 上海东普信息科技有限公司 Service data processing method, device, equipment and storage medium based on elastic search
CN111797096A (en) * 2020-06-29 2020-10-20 中国平安财产保险股份有限公司 Data indexing method and device based on ElasticSearch, computer equipment and storage medium

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112749166A (en) * 2021-01-15 2021-05-04 京东数字科技控股股份有限公司 Service data processing method, device, equipment and storage medium
CN112883243A (en) * 2021-01-25 2021-06-01 上海德启信息科技有限公司 Data query method and device, electronic equipment and storage medium
CN113268487A (en) * 2021-06-16 2021-08-17 中移(杭州)信息技术有限公司 Data statistical method, device and computer readable storage medium
CN113836186A (en) * 2021-09-28 2021-12-24 北京环境特性研究所 Simulation data query method and device based on ES search engine
CN113836186B (en) * 2021-09-28 2023-10-10 北京环境特性研究所 Simulation data query method and device based on ES search engine
CN116089437A (en) * 2022-11-30 2023-05-09 荣耀终端有限公司 Data processing method and server
CN116089437B (en) * 2022-11-30 2023-10-03 荣耀终端有限公司 Data processing method and server
CN117112618A (en) * 2023-10-25 2023-11-24 上海合见工业软件集团有限公司 EDA software data query method, electronic device and medium
CN117112618B (en) * 2023-10-25 2024-01-26 上海合见工业软件集团有限公司 EDA software data query method, electronic device and medium

Similar Documents

Publication Publication Date Title
CN112181993A (en) Service data query method, device, server and storage medium
KR101636603B1 (en) Method and system for a pre-shopping reservation system with increased search efficiency
CN111460023A (en) Service data processing method, device, equipment and storage medium based on elastic search
US20110040827A1 (en) Stream data processing method and apparatus
CN105160039A (en) Query method based on big data
CN105117502A (en) Search method based on big data
US20180173767A1 (en) System and method for facilitating queries via request-prediction-based temporary storage of query results
CN102402605A (en) Mixed distribution model for search engine indexing
CN104063376A (en) Multi-dimensional grouping operation method and system
CN108733790B (en) Data sorting method, device, server and storage medium
US10375157B2 (en) System and method for reducing data streaming and/or visualization network resource usage
US20220215010A1 (en) Optimizing database performance through intelligent data partitioning orchestration
CN111198961B (en) Commodity searching method, commodity searching device and commodity searching server
US11449521B2 (en) Database management system
CN106815223B (en) Mass picture management method and device
CN108345699B (en) Method, device and storage medium for acquiring multimedia data
CN112632058A (en) Track determination method, device and equipment and storage medium
CN110929207B (en) Data processing method, device and computer readable storage medium
CN113626516A (en) Data increment synchronization method and system
US10769110B2 (en) Facilitating queries for interaction data with visitor-indexed data objects
CN107766380B (en) Method, device and system for balanced distribution and search of service data
US20180173705A1 (en) System and method for facilitating queries via request-prediction-based temporary storage of query results
CN112445833B (en) Data paging query method, device and system of distributed database
CN112040283B (en) Method and system for splitting video mass selection list
US11798010B2 (en) Database management systems and methods using data normalization and defragmentation techniques

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination