Deep search optimization method, system, terminal and storage medium based on ES service
By setting the starting value and selecting secondary coordination nodes according to deep paging rules in the ES service, the retrieval tasks are shared, which solves the problem of memory overflow and program crash caused by deep retrieval, and improves business processing capabilities and customer experience.
Patent Information
- Application Number
- CN202110839379.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-23
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2041-07-23
AI Technical Summary
ES services can easily cause memory overflows and program crashes in deep retrieval scenarios. The existing circuit breaker mechanism forcibly closes retrieval tasks when resources are insufficient, resulting in business interruption and poor customer experience.
By collecting the data volume of the retrieval target, setting the starting value according to the preset deep paging rules, selecting multiple secondary coordination nodes, evenly distributing sharding tasks, reducing the load of single-point coordination nodes, and avoiding memory overflow.
It reduces the risk of memory overflow caused by deep retrieval, improves the business processing capability and availability of ES services, avoids program crashes, and improves customer experience.
Smart Images

Figure CN113672644B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ES service deep retrieval, and in particular to a deep retrieval optimization method, system, terminal and storage medium based on ES service. Background Art
[0002] ES service refers to a distributed full-text database system service Elasticsearch. ES is an open source distributed search engine based on the RESTful web interface and built on Apache Lucene. In the regular search of ES, there are two steps: query and fetch. In the first step of the query phase, the coordination node (a node that is selected in a query task to process and aggregate data) distributes tasks to the relevant shards of all instances according to the query conditions to query data, obtain the data ID and score information that meet the conditions, and then aggregate them to the coordination node after sorting. The second step is for the coordination node to summarize and sort the data ID obtained in the first step to obtain the final data information that needs to be obtained, and then distribute it to the shard where the data is located to retrieve the data content, and finally feed the data back to the query client.
[0003] The deep search function of the ES service generally refers to a special search function involving deep paging during the ES search process. The data queried by the deep search function is more detailed. Although in theory query is a lightweight operation in normal use, in some special scenarios, such as deep paging search (non-scroll query), when the user queries from 10000, the single page size is 10, and the queried data involves a single index to multiple shards or multiple indexes or even full database shards, it means that each shard will have 10010 data returned to the coordination node for aggregation processing. In this case, the coordination node will face the situation of processing too much data, resulting in resource overuse, and there will be excessive memory pressure, resulting in fuse or even memory overflow. The ES service itself does not have dedicated logic to identify and handle such scenarios.
[0004] Under the current technical background, the only circuit breaker mechanism that can circumvent or control the deep search problem is to monitor the usage of JVM (Java Virtual Machine, the container for ES service) when the service is running. The circuit breaker mechanism is the task load configuration of ES control instance, which is usually set as a percentage of available resources (memory), such as 20% of available resources. This configuration involves reading, writing and other program tasks. When the running content of an instance service consumes a lot (such as resource usage reaches the upper limit of 20%) and there are no more resources for executing query tasks, the ES service will urgently stop the running tasks to prevent the tasks from causing excessive use of cluster resources, resulting in memory overflow and program crashes.
[0005] The fuse mechanism forcibly closes the search task when resources are insufficient, and cannot guarantee the normal completion of the task. Although the fuse mechanism can relieve system pressure and avoid program crashes to a certain extent, it is a remedial measure triggered when a memory overflow occurs, which has a lag. In addition, forcibly closing the search task clears the search data that has been executed, which wastes computing resources and also causes a poor customer experience of the ES service. Summary of the invention
[0006] In view of the technical problem in the prior art that deep retrieval easily leads to memory overflow, program crash and retrieval business interruption, the present invention provides a deep retrieval optimization method, system, terminal and storage medium based on ES service to solve the above technical problems.
[0007] In a first aspect, the present invention provides a deep search optimization method based on ES service, comprising:
[0008] Collecting the data volume of the search target and setting the starting value of the search target according to the data volume and a preset deep paging rule;
[0009] Determine the target number of secondary coordination nodes according to the starting value, and select the target number of secondary coordination nodes;
[0010] Obtain all shards of the retrieval target distribution and evenly distribute all shards to each secondary coordination node;
[0011] The search results uploaded by the secondary coordination nodes are aggregated to obtain the query data id and the score sorting results, and the query data is returned to the client according to the query data id and the score sorting results.
[0012] Further, collecting the data volume of the search target and setting the starting value of the search target according to the data volume and a preset deep paging rule includes:
[0013] Pre-set multiple data volume levels and set a corresponding starting value for each data volume level, and save the mapping relationship between the data volume level and the starting value as a deep paging rule;
[0014] According to the data volume level to which the data volume of the search target belongs, a starting value corresponding to the data volume level is set as the starting value of the search target.
[0015] Further, collecting the data volume of the search target and setting the starting value of the search target according to the data volume and a preset deep paging rule includes:
[0016] Parse the document content of the retrieval target and calculate the statistical data.
[0017] Further, determining a target number of secondary coordination nodes according to the starting value, and selecting the target number of secondary coordination nodes includes:
[0018] Presetting a plurality of starting value levels and setting a matching number of secondary coordination nodes for each starting value level, and saving a matching relationship between the starting value level and the number of secondary coordination nodes as a resource allocation rule;
[0019] Determining a target number of secondary coordination nodes according to a resource allocation rule and a starting value of the retrieval target;
[0020] A target number of secondary coordinating nodes in an idle state are selected from the coordinating node.
[0021] Further, a target number of secondary coordination nodes in an idle state are selected from the coordination nodes, including:
[0022] Collect available memory resources of each coordination node, where available memory resources = total memory - memory usage;
[0023] Mark the coordination node whose available memory resources exceed the preset resource threshold as an idle coordination node;
[0024] A target number of secondary coordinating nodes are randomly selected from the idle coordinating nodes.
[0025] Furthermore, all shards of the retrieval target distribution are obtained and all shards are evenly distributed to each secondary coordination node, including:
[0026] Calculate the number of shards undertaken by each secondary coordination node. The number of shards = the number of all shards of the retrieval target distribution / the number of secondary coordination nodes.
[0027] A target shard group of the number of shards is selected from all shards in turn by using a random algorithm, and basic information of each shard of the target shard group is distributed to the secondary coordination node that has not received the shard task.
[0028] Furthermore, the search results uploaded by the secondary coordination nodes are aggregated to obtain the query data id and the score ranking results, and the query data is returned to the client according to the query data id and the score ranking results, including:
[0029] Receive the search results uploaded by each secondary coordination node, the search results including the query data id and the query data id score of the shard undertaken by the secondary coordination node, and mark the shard to which the search results belong;
[0030] Summarize all query data IDs, and generate the score ranking results of all query data IDs according to the query data ID scores;
[0031] Select the target query data id according to the score sorting result, retrieve the query data under the target query data id, and send the query data to the client.
[0032] In a second aspect, the present invention provides a deep search optimization system based on ES service, comprising:
[0033] A paging setting unit, used for collecting the data volume of the retrieval target and setting the starting value of the retrieval target according to the data volume and a preset deep paging rule;
[0034] A node selection unit, used to determine a target number of secondary coordination nodes according to a starting value, and select the target number of secondary coordination nodes;
[0035] The task allocation unit is used to obtain all the shards of the retrieval target distribution and evenly distribute all the shards to each secondary coordination node;
[0036] The result aggregation unit is used to aggregate the search results uploaded by the secondary coordination node to obtain the query data id and the score sorting result, and return the query data to the client according to the query data id and the score sorting result.
[0037] Furthermore, the paging setting unit is used to:
[0038] Pre-set multiple data volume levels and set a corresponding starting value for each data volume level, and save the mapping relationship between the data volume level and the starting value as a deep paging rule;
[0039] According to the data volume level to which the data volume of the search target belongs, a starting value corresponding to the data volume level is set as the starting value of the search target.
[0040] Furthermore, the paging setting unit is also used for:
[0041] Parse the document content of the retrieval target and calculate the statistical data.
[0042] Furthermore, the node selection unit is used to:
[0043] Presetting a plurality of starting value levels and setting a matching number of secondary coordination nodes for each starting value level, and saving a matching relationship between the starting value level and the number of secondary coordination nodes as a resource allocation rule;
[0044] Determining a target number of secondary coordination nodes according to a resource allocation rule and a starting value of the retrieval target;
[0045] A target number of secondary coordinating nodes in an idle state are selected from the coordinating node.
[0046] Further, a target number of secondary coordination nodes in an idle state are selected from the coordination nodes, including:
[0047] Collect available memory resources of each coordination node, where available memory resources = total memory - memory usage;
[0048] Mark the coordination node whose available memory resources exceed the preset resource threshold as an idle coordination node;
[0049] A target number of secondary coordinating nodes are randomly selected from the idle coordinating nodes.
[0050] Furthermore, the task allocation unit is used to: calculate the number of shards undertaken by each secondary coordination node, where the number of shards = the number of all shards of the retrieval target distribution / the number of secondary coordination nodes;
[0051] A target shard group of the number of shards is selected from all shards in turn by using a random algorithm, and basic information of each shard of the target shard group is distributed to the secondary coordination node that has not received the shard task.
[0052] Furthermore, the result summary unit is used to:
[0053] Receive the search results uploaded by each secondary coordination node, the search results including the query data id and the query data id score of the shard undertaken by the secondary coordination node, and mark the shard to which the search results belong;
[0054] Summarize all query data IDs, and generate the score ranking results of all query data IDs according to the query data ID scores;
[0055] Select the target query data id according to the score sorting result, retrieve the query data under the target query data id, and send the query data to the client.
[0056] In a third aspect, a terminal is provided, including:
[0057] processor, memory, wherein:
[0058] The memory is used to store computer programs.
[0059] The processor is used to call and run the computer program from the memory, so that the terminal executes the above-mentioned terminal method.
[0060] According to a fourth aspect, a computer storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the methods described in the above aspects.
[0061] The beneficial effects of the present invention are:
[0062] The deep search optimization method, system, terminal and storage medium based on ES service provided by the present invention set the starting value according to the amount of search target data, limit the amount of search data, avoid unlimited occupation of memory resources, and select multiple secondary coordination nodes according to the starting value to share the search task. Compared with concentrating all query data IDs in one coordination node, the risk of memory overflow is reduced, and then the main coordination node summarizes the search results of the secondary coordination nodes. The present invention reduces the risk of program crash caused by memory overflow of deep search and improves the business processing capability and availability of deep search of ES service.
[0063] In addition, the invention has a reliable design principle, a simple structure and a very broad application prospect. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0065] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention.
[0066] Figure 2 is a schematic block diagram of a system according to an embodiment of the present invention.
[0067] Figure 3 A schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0068] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0069] The key terms appearing in the present invention are explained below.
[0070] The starting value of the ES service is the from value. When performing a deep search, if from=9990 and size=10 are set, the search target is distributed in 5 shards. On each of the 5 nodes corresponding to the 5 shards, 10,000 data IDs are selected, for a total of 50,000 data IDs. After sorting by score, the data IDs from 9990 to 10,000 are taken.
[0071] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention. Figure 1 The execution entity may be a deep search optimization system based on ES services.
[0072] like Figure 1 As shown, the method includes:
[0073] Step 110, collecting the data volume of the search target and setting the starting value of the search target according to the data volume and a preset deep paging rule;
[0074] Step 120, determining a target number of secondary coordination nodes according to the starting value, and selecting the target number of secondary coordination nodes;
[0075] Step 130, obtaining all shards of the retrieval target distribution, and evenly distributing all shards to each secondary coordination node;
[0076] Step 140: Aggregate the search results uploaded by the secondary coordination nodes to obtain the query data id and the score ranking result, and return the query data to the client according to the query data id and the score ranking result.
[0077] To facilitate understanding of the present invention, the deep search optimization method based on ES service provided by the present invention is further described below based on the principle of the deep search optimization method based on ES service of the present invention and the process of optimizing the deep search based on ES service in the embodiment.
[0078] Specifically, the deep search optimization method based on ES service includes:
[0079] S1. Collect the data volume of the search target and set the starting value of the search target according to the data volume and a preset deep paging rule.
[0080] Preset multiple data volume levels and set corresponding starting values for each data volume level, save the mapping relationship between data volume level and starting value as deep paging rules; according to the data volume level to which the data volume of the retrieval target belongs, set the corresponding starting value of the corresponding data volume level as the starting value of the retrieval target. Analyze the document content of the retrieval target and calculate the data volume.
[0081] Specifically, first confirm that the deep search rule is enabled. After receiving the search request sent by the client, parse the search target to obtain the doc data volume. This embodiment divides the search target into simple search and complex search according to the size of the doc data volume. If the simple search is from more than 10000, it is defined as deep paging, and the complex search matches from 1000 as deep paging.
[0082] S2. Determine the target number of secondary coordination nodes according to the starting value, and select the target number of secondary coordination nodes.
[0083] Preset multiple starting value levels and set the matching number of secondary coordination nodes for each starting value level, save the matching relationship between the starting value level and the number of secondary coordination nodes as a resource allocation rule; determine the target number of secondary coordination nodes according to the resource allocation rule and the starting value of the retrieval target; select the target number of secondary coordination nodes in an idle state from the coordination nodes. Wherein, selecting the target number of secondary coordination nodes in an idle state from the coordination nodes includes: collecting the available memory resources of each coordination node, wherein the available memory resources = the total memory - the memory usage; marking the coordination nodes whose available memory resources exceed the preset resource threshold as coordination nodes in an idle state; and randomly selecting the target number of secondary coordination nodes from the coordination nodes in an idle state.
[0084] In this embodiment, multiple coordination nodes are set, and the coordination node that receives the client request is the main coordination node. In order not to occupy too many coordination node resources, it is necessary to reasonably select the number of secondary coordination nodes. In this embodiment, the number of secondary coordination nodes is determined according to the size of the from value. For example, from10000 is a medium-depth paging grouping of 5 secondary coordination nodes, and from100000 is a heavy-depth paging grouping of 10 secondary coordination nodes for task processing. As from doubles, the number of secondary coordination nodes also doubles to ensure the operation of the task.
[0085] After determining the number of secondary coordination nodes, the selection of secondary coordination nodes must be based on the available memory resources of the coordination nodes. If the available memory resources are insufficient, the deep search task cannot be performed temporarily. Therefore, the memory usage rate is set to be less than 80% in this community, that is, only idle coordination nodes with available memory resources exceeding 20% can be selected as secondary coordination nodes.
[0086] S3. Obtain all shards of the retrieval target distribution and evenly distribute all shards to each secondary coordination node.
[0087] Calculate the number of shards undertaken by each secondary coordination node, the number of shards = the number of all shards of the target distribution to be retrieved ÷ the number of secondary coordination nodes; use a random algorithm to select the target shard group of the number of shards from all shards in turn, and distribute the basic information of each shard of the target shard group to the secondary coordination nodes that have not received the shard task.
[0088] For example, the shards of the retrieval target distribution are shard1, shard2, shard3, shard4, and shard5, and the secondary coordination nodes are node1, node2, node3, node4, and node5. Then a shard is randomly assigned to each node, that is, node1-shard1, node2-shard2, node3-shard3, node4-shard4, and node5-shard5.
[0089] If the number of shards is 6, one shard is allocated to each secondary coordination node on average, and the remaining shard is allocated to the secondary coordination node with the largest amount of available memory. During the search, each secondary coordination node is responsible for retrieving the shard assigned to it, so that the search task of each secondary coordination node can be completed in a more balanced manner.
[0090] S4. Summarize the search results uploaded by the secondary coordination nodes to obtain the query data id and the score sorting results, and return the query data to the client according to the query data id and the score sorting results.
[0091] Receive the retrieval results uploaded by each secondary coordination node, the retrieval results including the query data id and query data id score of the shard undertaken by the secondary coordination node, mark the shard to which the retrieval results belong; aggregate all query data ids, and generate score ranking results for all query data ids based on the query data id scores; select the target query data id based on the score ranking results, retrieve the query data under the target query data id, and send the query data to the client.
[0092] The master coodinator aggregates the search results of all the secondary coordinators and sorts them to get the final result. The master coordinator gets the final search result and returns the result to the client.
[0093] The deep search optimization method based on ES service provided in this embodiment sets the starting value according to the amount of search target data, limits the amount of search data, avoids unlimited occupation of memory resources, and selects multiple secondary coordination nodes according to the starting value to share the search task. Compared with concentrating all query data IDs in one coordination node, the risk of memory overflow is reduced. Then the main coordination node can summarize the search results of the secondary coordination nodes. The present invention reduces the risk of program crash caused by memory overflow of deep search and improves the business processing capability and availability of deep search of ES service.
[0094] like Figure 2 As shown, the system 200 includes:
[0095] A paging setting unit 210, used to collect the data volume of the search target and set the starting value of the search target according to the data volume and a preset deep paging rule;
[0096] A node selection unit 220, configured to determine a target number of secondary coordination nodes according to a starting value, and select the target number of secondary coordination nodes;
[0097] The task allocation unit 230 is used to obtain all the shards of the retrieval target distribution and evenly allocate all the shards to each secondary coordination node;
[0098] The result aggregation unit 240 is used to aggregate the search results uploaded by the secondary coordination nodes to obtain the query data id and the score ranking result, and return the query data to the client according to the query data id and the score ranking result.
[0099] Optionally, as an embodiment of the present invention, the paging setting unit is used to:
[0100] Pre-set multiple data volume levels and set a corresponding starting value for each data volume level, and save the mapping relationship between the data volume level and the starting value as a deep paging rule;
[0101] According to the data volume level to which the data volume of the search target belongs, a starting value corresponding to the data volume level is set as the starting value of the search target.
[0102] Optionally, as an embodiment of the present invention, the paging setting unit is further used for:
[0103] Parse the document content of the retrieval target and calculate the statistical data.
[0104] Optionally, as an embodiment of the present invention, the node selection unit is used to:
[0105] Presetting a plurality of starting value levels and setting a matching number of secondary coordination nodes for each starting value level, and saving a matching relationship between the starting value level and the number of secondary coordination nodes as a resource allocation rule;
[0106] Determining a target number of secondary coordination nodes according to a resource allocation rule and a starting value of the retrieval target;
[0107] A target number of secondary coordinating nodes in an idle state are selected from the coordinating node.
[0108] Optionally, as an embodiment of the present invention, selecting a target number of secondary coordination nodes in an idle state from the coordination nodes includes:
[0109] Collect available memory resources of each coordination node, where available memory resources = total memory - memory usage;
[0110] Mark the coordination node whose available memory resources exceed the preset resource threshold as an idle coordination node;
[0111] A target number of secondary coordinating nodes are randomly selected from the idle coordinating nodes.
[0112] Optionally, as an embodiment of the present invention, the task allocation unit is used to: calculate the number of shards undertaken by each secondary coordination node, the number of shards = the number of all shards of the retrieval target distribution / the number of secondary coordination nodes;
[0113] A target shard group of the number of shards is selected from all shards in turn by using a random algorithm, and basic information of each shard of the target shard group is distributed to the secondary coordination node that has not received the shard task.
[0114] Optionally, as an embodiment of the present invention, the result aggregation unit is used to:
[0115] Receive the search results uploaded by each secondary coordination node, the search results including the query data id and the query data id score of the shard undertaken by the secondary coordination node, and mark the shard to which the search results belong;
[0116] Summarize all query data IDs, and generate the score ranking results of all query data IDs according to the query data ID scores;
[0117] Select the target query data id according to the score sorting result, retrieve the query data under the target query data id, and send the query data to the client.
[0118] Figure 3 A schematic diagram of the structure of a terminal 300 provided in an embodiment of the present invention. The terminal 300 can be used to execute the deep search optimization method based on ES service provided in an embodiment of the present invention.
[0119] The terminal 300 may include: a processor 310, a memory 320 and a communication unit 330. These components communicate via one or more buses. Those skilled in the art will appreciate that the server structure shown in the figure does not limit the present invention, and it may be a bus structure or a star structure, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0120] The memory 320 can be used to store the execution instructions of the processor 310, and the memory 320 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. When the execution instructions in the memory 320 are executed by the processor 310, the terminal 300 can perform some or all of the steps in the following method embodiments.
[0121] The processor 310 is the control center of the storage terminal, and uses various interfaces and lines to connect various parts of the entire electronic terminal. It runs or executes software programs and / or modules stored in the memory 320, and calls data stored in the memory to perform various functions of the electronic terminal and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of a plurality of packaged ICs with the same or different functions. For example, the processor 310 can include only a central processing unit (CPU). In the embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.
[0122] The communication unit 330 is used to establish a communication channel so that the storage terminal can communicate with other terminals, receive user data sent by other terminals or send user data to other terminals.
[0123] The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, the program may include some or all of the steps in each embodiment provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).
[0124] Therefore, the present invention sets a starting value according to the amount of target data to be retrieved, limits the amount of retrieved data, avoids unlimited occupation of memory resources, and selects multiple secondary coordination nodes according to the starting value to share the retrieval task. Compared with concentrating all query data IDs in one coordination node, the risk of memory overflow is reduced. The main coordination node can then summarize the retrieval results of the secondary coordination nodes. The present invention reduces the risk of program crashes caused by memory overflows in deep retrievals, improves the business processing capabilities and availability of deep retrieval of ES services, and the technical effects that can be achieved by this embodiment can be found in the description above, which will not be repeated here.
[0125] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention, in essence or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes, including several instructions for enabling a computer terminal (which can be a personal computer, a server, or a second terminal, a network terminal, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention.
[0126] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the terminal embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.
[0127] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.
[0128] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0129] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0130] Although the present invention has been described in detail by referring to the accompanying drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, a person of ordinary skill in the art may make various equivalent modifications or substitutions to the embodiments of the present invention, and these modifications or substitutions shall be within the scope of the present invention. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, and all of these shall be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
Claims
1. A deep search optimization method based on ES service, characterized in that: include: Collecting the data volume of the search target and setting the starting value of the search target according to the data volume and a preset deep paging rule; Determine the target number of secondary coordination nodes according to the starting value, and select the target number of secondary coordination nodes; Obtain all shards of the retrieval target distribution and evenly distribute all shards to each secondary coordination node; Aggregate the search results uploaded by the secondary coordination node to obtain the query data id and score ranking results, and return the query data to the client based on the query data id and score ranking results; Determine the target number of secondary coordination nodes according to the starting value, and select the target number of secondary coordination nodes, including: Presetting a plurality of starting value levels and setting a matching number of secondary coordination nodes for each starting value level, and saving a matching relationship between the starting value level and the number of secondary coordination nodes as a resource allocation rule; Determining a target number of secondary coordination nodes according to a resource allocation rule and a starting value of the retrieval target; A target number of secondary coordinating nodes in an idle state are selected from the coordinating node.
2. The method according to claim 1, characterized in that Collecting the data volume of the search target and setting the starting value of the search target according to the data volume and a preset deep paging rule, including: Pre-set multiple data volume levels and set a corresponding starting value for each data volume level, and save the mapping relationship between the data volume level and the starting value as a deep paging rule; According to the data volume level to which the data volume of the search target belongs, a starting value corresponding to the data volume level is set as the starting value of the search target.
3. The method according to claim 2, characterized in that Collecting the data volume of the search target and setting the starting value of the search target according to the data volume and a preset deep paging rule, including: Parse the document content of the retrieval target and calculate the statistical data.
4. The method according to claim 1, characterized in that: Select a target number of idle secondary coordinating nodes from the coordinating node, including: Collect available memory resources of each coordination node, where available memory resources = total memory - memory usage; Mark the coordination node whose available memory resources exceed the preset resource threshold as an idle coordination node; A target number of secondary coordinating nodes are randomly selected from the idle coordinating nodes.
5. The method according to claim 1, characterized in that Get all the shards of the retrieval target distribution and evenly distribute all the shards to each secondary coordination node, including: Calculate the number of shards undertaken by each secondary coordination node. The number of shards = the number of all shards of the retrieval target distribution / the number of secondary coordination nodes. A target shard group of the number of shards is selected from all shards in turn by using a random algorithm, and basic information of each shard of the target shard group is distributed to the secondary coordination node that has not received the shard task.
6. The method according to claim 1, characterized in that Aggregate the search results uploaded by the secondary coordination node to obtain the query data id and score sorting results, and return the query data to the client based on the query data id and score sorting results, including: Receive the search results uploaded by each secondary coordination node, the search results including the query data id and the query data id score of the shard undertaken by the secondary coordination node, and mark the shard to which the search results belong; Summarize all query data IDs, and generate the score ranking results of all query data IDs according to the query data ID scores; Select the target query data id according to the score sorting result, retrieve the query data under the target query data id, and send the query data to the client.
7. A deep search optimization system based on ES service, characterized in that: include: A paging setting unit, used for collecting the data volume of the retrieval target and setting the starting value of the retrieval target according to the data volume and a preset deep paging rule; A node selection unit, used to determine a target number of secondary coordination nodes according to a starting value, and select the target number of secondary coordination nodes; The task allocation unit is used to obtain all the shards of the retrieval target distribution and evenly distribute all the shards to each secondary coordination node; A result aggregation unit is used to aggregate the search results uploaded by the secondary coordination node to obtain the query data ID and the score ranking result, and return the query data to the client according to the query data ID and the score ranking result; The node selection unit is used to: pre-set a plurality of starting value levels and set a matching number of secondary coordination nodes for each starting value level, and save the matching relationship between the starting value level and the number of secondary coordination nodes as a resource allocation rule; Determining a target number of secondary coordination nodes according to a resource allocation rule and a starting value of the retrieval target; A target number of secondary coordinating nodes in an idle state are selected from the coordinating node.
8. A terminal, characterized in that: include: processor; A memory for storing execution instructions of the processor; The processor is configured to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
