Index data updating method, device, equipment and storage medium

By considering the data structure type of the target index field of the field to be updated during the index data update process, and building and using reference update fields, the problem of inaccurate and inefficient update of the index data is solved, and efficient and accurate index data update is achieved.

CN117194435BActive Publication Date: 2025-04-08DAWNING CLOUD COMPUTING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311255903.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-26
Publication Date
2025-04-08
Estimated Expiration
2043-09-26

AI Technical Summary

Technical Problem

The index data update method of existing index documents has the problem of inaccurate update and low update efficiency.

Method used

By obtaining the data to be updated, determining the index document to be updated and the target index field, building a reference update field, and determining the reference field value based on the value of the field to be updated and the data structure type of the target index field, so as to accurately update the index data.

Benefits of technology

It realizes accurate update of index data, improves the update efficiency of index data, and reduces the update time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117194435B_ABST
    Figure CN117194435B_ABST
Patent Text Reader

Abstract

The present invention discloses an index data updating method, device, equipment and storage medium. The method comprises: obtaining data to be updated, and determining the index document to be updated corresponding to the data to be updated; determining the target index fields in the index document to be updated that correspond to the fields to be updated in the data to be updated; constructing reference update fields corresponding to the fields to be updated; determining the reference field value of the reference update field corresponding to the field to be updated based on the field value to be updated of the field to be updated and the data structure type of the target index field corresponding to the field to be updated; and updating the index field value of the index document to be updated based on the field value to be updated of the field to be updated and the reference field value of the reference update field. The embodiment of the present invention realizes accurate update of index data and improves the update efficiency of index data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to an index data updating method, device, equipment and storage medium. Background Art

[0002] With the continuous development of database technology, distributed search engines are widely used in various fields. When the full amount of data is stored in the engine index in a certain data table structure or mode, the index mapping relationship is also determined. While maintaining the original index mapping relationship, how to update the data in the index document in a universal and efficient way has become an urgent problem to be solved.

[0003] Currently, there are two main ways to update index data in index documents: one is to modify, delete, and add index data in index documents based on request statements such as post, delete, or put; the other is to update the data to be updated into the index of the retrieval engine using writing methods such as dataset or dataframe.

[0004] However, the existing index data updating method of index documents has the problem that the index data cannot be updated accurately, and has the problem that the index data update time is long and the update efficiency is low. Summary of the invention

[0005] The present invention provides an index data updating method, device, equipment and storage medium to achieve accurate updating of index data and improve the updating efficiency of index data.

[0006] According to one aspect of the present invention, a method for updating index data is provided, the method comprising:

[0007] Acquire the data to be updated, and determine the index document to be updated corresponding to the data to be updated;

[0008] Determine target index fields in the to-be-updated index document that correspond to the to-be-updated fields in the to-be-updated data;

[0009] Constructing a reference update field corresponding to the field to be updated;

[0010] Determine, according to the to-be-updated field value of the to-be-updated field and based on the data structure type of the target index field corresponding to the to-be-updated field, the reference field value of the reference update field corresponding to the to-be-updated field;

[0011] According to the to-be-updated field value of the to-be-updated field and the reference field value of the reference update field, data is updated on the index field value of the to-be-updated index document.

[0012] Optionally, the determining, according to the to-be-updated field value of the to-be-updated field and based on the data structure type of the target index field corresponding to the to-be-updated field, the reference field value of the reference update field corresponding to the to-be-updated field includes:

[0013] If the data structure type of the target index field corresponding to the to-be-updated field is an atomic structure type, the to-be-updated field value of the to-be-updated field is determined as the reference field value of the reference update field corresponding to the to-be-updated field.

[0014] The above technical solution directly determines the to-be-updated field value of the to-be-updated field as the reference field value of the reference update field corresponding to the to-be-updated field, thereby realizing the accurate determination of the reference field value of the reference update field when the data structure type of the target index field is an atomic structure type, thereby laying the foundation for improving the accuracy of subsequent updates to the index data.

[0015] Optionally, the determining, according to the to-be-updated field value of each to-be-updated field and based on the data structure type of the target index field corresponding to the corresponding to-be-updated field, the reference field value of the reference update field corresponding to each to-be-updated field includes:

[0016] If the data structure type of the target index field corresponding to the field to be updated is a composite structure type, determining a target data conversion method corresponding to the composite structure type;

[0017] According to the target data conversion method, performing data structure conversion on the to-be-updated field value of the to-be-updated field to obtain a converted field value;

[0018] The converted field value is determined as a reference field value of a reference update field corresponding to the field to be updated.

[0019] The above technical scheme determines the target data conversion method corresponding to the composite structure type, performs data structure conversion on the to-be-updated field value of the to-be-updated field according to the target data conversion method, obtains the converted field value, and determines the converted field value as the reference field value of the reference update field corresponding to the to-be-updated field. This achieves accurate determination of the reference field value of the reference update field when the data structure type of the target index field is a composite structure type, thereby laying a foundation for improving the accuracy of subsequent updates to the index data.

[0020] Optionally, updating the index field value of the to-be-updated index document according to the to-be-updated field value of the to-be-updated field and the reference field value of the reference update field includes:

[0021] Determine whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated;

[0022] If so, determining whether the to-be-updated field value is consistent with the index field value under the target index field;

[0023] If not, the to-be-updated field value is adopted to update the index field value under the target index field in the to-be-updated index document.

[0024] The above technical solution determines whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated; if so, determines whether the field value to be updated is consistent with the index field value under the target index field; if not, uses the field value to be updated to update the index field value under the target index field in the index document to be updated. The above technical solution further improves the accuracy of updating the index data and the efficiency of updating the index data by considering different data update scenarios in the process of updating the index field value and using different data update methods in different data update scenarios.

[0025] Optionally, after determining whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated, the method further includes:

[0026] If it is determined that there is no index field value under the target index field corresponding to the field to be updated in the index document to be updated, the reference field value of the reference update field is added to the target index field to update the index field value of the index document to be updated.

[0027] The above technical solution realizes data update of the index field value of the index document to be updated in the scenario where it is determined that there is no index field value under the target index field corresponding to the field to be updated in the index document to be updated, by directly adding the reference field value of the reference update field to the target index field.

[0028] Optionally, the adopting the to-be-updated field value to update the index field value under the target index field in the to-be-updated index document includes:

[0029] If the data structure type of the target index field is an atomic structure type, the to-be-updated field value is used to replace the index field value under the target index field in the to-be-updated index document.

[0030] The above technical solution realizes the update of index data when the data structure type of the target index field is an atomic structure type by directly replacing the index field value under the target index field in the index document to be updated with the field value to be updated, thereby improving the update efficiency and accuracy of the index data.

[0031] Optionally, the adopting the to-be-updated field value to update the index field value under the target index field in the to-be-updated index document includes:

[0032] If the data structure type of the target index field is a composite structure type, determining a data insertion method corresponding to the composite structure type;

[0033] According to the to-be-updated field value and based on the data insertion method, the index field value under the target index field in the to-be-updated index document is updated.

[0034] The above technical solution determines the data insertion method corresponding to the composite structure type, and updates the index field value under the target index field in the index document to be updated based on the data insertion method according to the field value to be updated, thereby realizing the update of index data when the data structure type of the target index field is a composite structure type, thereby improving the update efficiency and accuracy of the index data.

[0035] According to another aspect of the present invention, there is provided an index data updating device, the device comprising:

[0036] The to-be-updated data acquisition module is used to acquire the to-be-updated data and determine the to-be-updated index document corresponding to the to-be-updated data;

[0037] An index field determination module, used to determine target index fields in the to-be-updated index document that correspond to the to-be-updated fields in the to-be-updated data;

[0038] A reference field construction module, used to construct a reference update field corresponding to the field to be updated;

[0039] A reference field value determination module, configured to determine a reference field value of a reference update field corresponding to the field to be updated according to the field value to be updated of the field to be updated and based on a data structure type of a target index field corresponding to the field to be updated;

[0040] The index data updating module is used to update the index field value of the to-be-updated index document according to the to-be-updated field value of the to-be-updated field and the reference field value of the reference update field.

[0041] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0042] at least one processor; and

[0043] a memory communicatively connected to the at least one processor; wherein,

[0044] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the index data updating method described in any embodiment of the present invention.

[0045] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the index data updating method described in any embodiment of the present invention when executed.

[0046] The technical solution of the embodiment of the present invention obtains the data to be updated and determines the index document to be updated corresponding to the data to be updated; determines the target index fields in the index document to be updated that correspond to the fields to be updated in the data to be updated; constructs the reference update fields corresponding to the fields to be updated; determines the reference field value of the reference update field corresponding to the field to be updated based on the field value to be updated of the field to be updated and the data structure type of the target index field corresponding to the field to be updated; updates the index field value of the index document to be updated based on the field value to be updated of the field to be updated and the reference field value of the reference update field. The above technical solution realizes the accurate update of the index data by considering the data structure type of the target index field corresponding to the field to be updated in the process of updating the index data; by introducing and constructing the reference update field corresponding to the field to be updated, and combining the reference update field to realize the update of the index data, the update time of the index data is reduced, thereby improving the update efficiency of the index data.

[0047] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0049] Figure 1 is a flowchart of an index data updating method provided according to Embodiment 1 of the present invention;

[0050] Figure 2 is a flowchart of an index data updating method provided according to Embodiment 2 of the present invention;

[0051] Figure 3is a flowchart of an index data updating method provided according to Embodiment 3 of the present invention;

[0052] Figure 4 is a structural diagram of an index data updating device provided according to a fourth embodiment of the present invention;

[0053] Figure 5 It is a structural schematic diagram of an electronic device for implementing the index data updating method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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.

[0055] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0056] Embodiment 1

[0057] Figure 1 This is a flowchart of an index data updating method provided in Embodiment 1 of the present invention. This embodiment is applicable to the case of updating index data in an index document. The method can be executed by an index data updating device. The index data updating device can be implemented in the form of hardware and / or software. The index data updating device can be configured in an electronic device. Figure 1 As shown, the method includes:

[0058] S110: Acquire the data to be updated, and determine the index document to be updated corresponding to the data to be updated.

[0059] The data to be updated may be incremental data used to update the current index data in the index document. The index document to be updated may be an index document that is associated with the data to be updated and has an update requirement. The index document to be updated may be stored in a search engine; the search engine may be a distributed search engine, for example, the distributed search engine may be Elasticsearch (distributed search and analysis engine).

[0060] The data to be updated may be generated by an initiator with a data update requirement, and a document identifier may be added to the data to be updated during the generation process, which is used to uniquely represent the index document to be updated that is associated with the data to be updated. The association between the data to be updated and the index document to be updated may be to update the data to be updated to a certain index position of the index document to be updated.

[0061] Exemplarily, in response to a demand for updating index data of an index document, the data to be updated is obtained; and based on a document identifier corresponding to the data to be updated, an index document to be updated that is associated with the data to be updated and has an update demand is determined.

[0062] S120: Determine target index fields in the to-be-updated index document that correspond to the to-be-updated fields in the to-be-updated data.

[0063] It should be noted that if there are fields in the data to be updated whose field values ​​are used for positioning or indexing, and there are fields whose field values ​​need to be actually updated to the fields in the document to be updated, the fields whose field values ​​in the data to be updated actually need to be updated are the fields to be updated. In at least one index field in the index document to be updated, the index field that is the same as the field to be updated is the target index field.

[0064] Take the data expression form of the data to be updated as a table structure as an example for explanation. The data table name of the data to be updated is add_table, and the data table name of the index document to be updated is my_index, as shown in Table 1 for the data to be updated and Table 2 for the index document to be updated.

[0065] Table 1

[0066]

[0067] Table 2

[0068]

[0069] Among them, the ID field is the positioning or indexing field, which is used to locate whether the field value corresponding to the ID field exists or partially exists under the field corresponding to the field to be updated in the index document to be updated. The fields to be updated in the add_table data to be updated are the field1 field and the field2 field; accordingly, the target index fields in the index document to be updated are the field1 field and the field2 field.

[0070] S130: Construct a reference update field corresponding to the field to be updated.

[0071] The reference update field is a field with the same number of fields as the field to be updated. The reference update field has a corresponding relationship with the field to be updated, and the field names of the constructed reference update field and the corresponding field to be updated can be the same or different.

[0072] For example, taking the data to be updated in Table 1 as an example, if the fields to be updated are field1 and field2, the reference update field corresponding to field1 to be updated may be param1; the reference update field corresponding to field2 to be updated may be param2. It should be noted that the reference field value in the reference update field initially constructed may be a null value, and the reference update field value of the reference update field is subsequently filled according to the field value to be updated corresponding to the field to be updated.

[0073] S140. Determine, according to the to-be-updated field value of the to-be-updated field and based on the data structure type of the target index field corresponding to the to-be-updated field, the reference field value of the reference update field corresponding to the to-be-updated field.

[0074] It should be noted that in the process of updating index data, there may be a situation where the data structure type of the field to be updated and its corresponding target index field does not correspond. If the field value of a different data structure type is updated directly, the update may fail or the updated index data may be missing, the data may be confused, and other inaccurate data updates may occur.

[0075] The data structure type may be an atomic structure type or a composite structure type. For example, the atomic structure type may include an integer type and a character type, etc.; the composite structure type may include an array, a tuple, a dictionary, a list, a set, etc.

[0076] Exemplarily, the reference field value of the reference update field corresponding to the field to be updated can be determined based on the field value to be updated of the field to be updated, and in the determination process, it is determined whether to perform data structure conversion on the field value to be updated based on the data structure type of the target index field corresponding to the field to be updated.

[0077] In an optional embodiment, according to the to-be-updated field value of the field to be updated, based on the data structure type of the target index field corresponding to the field to be updated, the reference field value of the reference update field corresponding to the field to be updated is determined, including: if the data structure type of the target index field corresponding to the field to be updated is an atomic structure type, then the to-be-updated field value of the field to be updated is determined as the reference field value of the reference update field corresponding to the field to be updated.

[0078] It is understandable that when updating the index data of the atomic structure type, the atomic structure type data can be directly added or inserted into the corresponding index field without causing index data update failures such as data missing, data duplication, or data confusion.

[0079] Take the data table shown in Table 1 as an example for explanation. If the field to be updated is field1, the field values ​​to be updated of field1 are Value1_new and Value2; the data structure type of the target index field1 corresponding to the field to be updated is an atomic structure type, then there is no need to perform data structure type conversion, and the reference field values ​​of the reference update field param1 corresponding to the field1 are both Value1_new and Value2.

[0080] This optional embodiment directly determines the to-be-updated field value of the to-be-updated field as the reference field value of the reference update field corresponding to the to-be-updated field, thereby achieving accurate determination of the reference field value of the reference update field when the data structure type of the target index field is an atomic structure type, thereby laying a foundation for improving the accuracy of subsequent updates to the index data.

[0081] In another optional embodiment, according to the to-be-updated field values ​​of each to-be-updated field, based on the data structure type of the target index field corresponding to the corresponding to-be-updated field, the reference field value of the reference update field corresponding to each to-be-updated field is determined, including: if the data structure type of the target index field corresponding to the to-be-updated field is a composite structure type, then determining the target data conversion method corresponding to the composite structure type; according to the target data conversion method, performing data structure conversion on the to-be-updated field value of the to-be-updated field to obtain a converted field value; and determining the converted field value as the reference field value of the reference update field corresponding to the to-be-updated field.

[0082] It should be noted that when updating the index data of a composite structure type, the data to be updated of the composite structure type needs to be converted into a structural type before updating the index data. If the data of the composite structure type is directly added or inserted into the corresponding index field, the index data update will fail, such as data missing, data duplication, or data confusion.

[0083] Among them, different composite structure types may correspond to different data conversion methods. For example, the data conversion method corresponding to the tuple structure type may be a tuple data conversion method; and the data conversion method corresponding to the array structure type may be an array data conversion method.

[0084] Exemplarily, if the data structure type of the target index field corresponding to the field to be updated is a composite structure type, the target data conversion method corresponding to the composite structure type is determined, and the data structure conversion is performed on the field value to be updated of the field to be updated based on the target data conversion method. Take the data to be updated as the data table shown in Table 1 as an example for illustration. If the field to be updated is field2, the field values ​​to be updated of field2 are Value2_4 and Value3_1; the data structure type of the target index field2 corresponding to the field to be updated is a composite structure type, then based on the target data conversion method corresponding to the composite structure type, the field values ​​to be updated are Value2_4 and Value3_1, and the converted field value [Value2_4] after the composite data structure type conversion of the field value to be updated is obtained, and the converted field value [Value3_1] after the composite data structure type conversion of the field value to be updated is obtained. Correspondingly, the reference field value of the reference update field param2 corresponding to the field to be updated field2 is the converted field value [Value2_4] and the converted field value [Value3_1].

[0085] This optional embodiment determines the target data conversion method corresponding to the composite structure type, performs data structure conversion on the to-be-updated field value of the to-be-updated field according to the target data conversion method, obtains the converted field value, and determines the converted field value as the reference field value of the reference update field corresponding to the to-be-updated field. This achieves accurate determination of the reference field value of the reference update field when the data structure type of the target index field is a composite structure type, thereby laying a foundation for improving the accuracy of subsequent updates to the index data.

[0086] S150 . Update the index field value of the to-be-updated index document according to the to-be-updated field value of the to-be-updated field and the reference field value of the reference update field.

[0087] Exemplarily, for different index data update scenarios, the field value to be updated or the reference field value can be selected to implement data update of the index field value of the index document to be updated. Specifically, for the scenario where the index field value of the index document to be updated is blank, the reference field value of the reference update field can be used to update the index field value of the index document to be updated; for the scenario where the index field value of the index document to be updated is not blank, the field value to be updated of the update field to be updated can be used to update the index field value of the index document to be updated.

[0088] The technical solution of the embodiment of the present invention obtains the data to be updated and determines the index document to be updated corresponding to the data to be updated; determines the target index fields in the index document to be updated that correspond to the fields to be updated in the data to be updated; constructs the reference update fields corresponding to the fields to be updated; determines the reference field value of the reference update field corresponding to the field to be updated based on the field value to be updated of the field to be updated and the data structure type of the target index field corresponding to the field to be updated; updates the index field value of the index document to be updated based on the field value to be updated of the field to be updated and the reference field value of the reference update field. The above technical solution realizes the accurate update of the index data by considering the data structure type of the target index field corresponding to the field to be updated in the process of updating the index data; by introducing and constructing the reference update field corresponding to the field to be updated, and combining the reference update field to realize the update of the index data, the update time of the index data is reduced, thereby improving the update efficiency of the index data.

[0089] Embodiment 2

[0090] Figure 2 This is a flow chart of an index data updating method provided in Embodiment 2 of the present invention. This embodiment is optimized and improved on the basis of the above technical solutions.

[0091] Further, the step of "updating the index field value of the to-be-updated index document according to the to-be-updated field value of the to-be-updated field and the reference field value of the reference update field" is refined into "determining whether there is an index field value under the target index field corresponding to the to-be-updated field in the to-be-updated index document; if so, determining whether the to-be-updated field value is consistent with the index field value under the target index field; if not, using the to-be-updated field value to update the index field value under the target index field in the to-be-updated index document." to improve the update method of the index field value under the target index field. It should be noted that for the parts not described in detail in the embodiments of the present invention, reference can be made to the descriptions of other embodiments.

[0092] like Figure 2 As shown, the method comprises the following specific steps:

[0093] S210: Acquire the data to be updated, and determine the index document to be updated corresponding to the data to be updated.

[0094] S220: Determine target index fields in the to-be-updated index document that correspond to the to-be-updated fields in the to-be-updated data.

[0095] S230: Construct a reference update field corresponding to the field to be updated.

[0096] S240. Determine, according to the to-be-updated field value of the to-be-updated field and based on the data structure type of the target index field corresponding to the to-be-updated field, the reference field value of the reference update field corresponding to the to-be-updated field.

[0097] S250: Determine whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated.

[0098] Take the table 3 data table add_table_updata for the data to be updated and the table 4 data table my_index_1 for the data to be updated as an example. For the field 1 to be processed, there is no index field value with ID 3 under the target index field 1 in the index document my_index_1 to be updated; all index field values ​​with ID 1 are missing; and some index field values ​​with ID 2 are missing. For the field 2 to be processed, there is no index field value with ID 3 under the target index field 1 in the index document my_index_1 to be updated; and all index field values ​​with ID 2 are missing.

[0099] Table 3

[0100]

[0101] Table 4

[0102]

[0103] S260: If it exists, determine whether the field value to be updated is consistent with the index field value under the target index field.

[0104] For example, if it is determined that there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated, it is necessary to further determine whether the field value to be updated is consistent with the index field value under the target index field. For example, if the field value to be updated and the index field value are completely consistent, it indicates consistency, and if there is partial consistency and partial missing, it indicates inconsistency.

[0105] In an optional embodiment, after determining whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated, it also includes: if it is determined that there is no index field value under the target index field corresponding to the field to be updated in the index document to be updated, then the reference field value of the reference update field is added to the target index field to perform data update on the index field value of the index document to be updated.

[0106] If it is determined that there is no index field value under the target index field corresponding to the field to be updated in the index document to be updated, the reference field value of the reference update field can be directly added to the target index field to implement data update of the index field value of the index document to be updated.

[0107] Take the above data to be updated as table 3 data table add_table_updata and the index document to be updated as table 4 data table my_index_1 as an example for explanation. For the field to be updated field1, in the index document to be updated my_index_1, there is no index field value under the target index field field1 with ID 1, and there is no index field value with ID 3; for the field to be updated field2, in the index document to be updated my_index_1, there is no index field value under the target index field field2 with ID 2, and there is no index field value with ID 3. The reference field value of the reference update field is directly added to the target index field to implement data update of the index field value of the index document to be updated. If the reference update field param1 corresponding to the field to be processed field1 and the reference update field param2 corresponding to the field to be processed field2 are shown in Table 5, the updated my_index_1_new is shown in Table 6.

[0108] Table 5

[0109] ID param1 param2 1 Value1_1 [Value2_1] 2 Value1_21+Value1_22 [Value2_2] 3 Value1_3 [Value2_3]

[0110] Table 6

[0111]

[0112] This optional embodiment scheme achieves data update of the index field value of the index document to be updated in a scenario where it is determined that there is no index field value under the target index field corresponding to the field to be updated in the index document to be updated, by directly adding the reference field value of the reference update field to the target index field.

[0113] S270: If not, use the field value to be updated to update the index field value under the target index field in the index document to be updated.

[0114] Exemplarily, if it is determined that there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated, and the field value to be updated is consistent with the index field value under the target index field, then there is no need to update the index field value under the target index field; if it is determined that there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated, but the field value to be updated is inconsistent with the index field value under the target index field, then the field value to be updated is used to update the index field value under the target index field in the index document to be updated.

[0115] Take the above data to be updated as table 3 data table add_table_updata and the index document to be updated as table 4 data table my_index_1 as an example for explanation. For the field to be updated field1, in the index document to be updated my_index_1, the index field value under the target index field with ID 2 is not completely consistent with the field value to be updated of the field to be updated with ID 2 in the field to be updated field1, and there is a partial missing. Then, the field value Value1_21+Value1_22 to be updated is used to update the index field value Value1_21 under the target index field in the index document to be updated. Specifically, the index field value Value1_21 can be directly replaced by the field value Value1_21+Value1_22 to be updated, or the missing field value Value1_22 can be added to the target index field.

[0116] It should be noted that when the to-be-updated field value is used to update the index field value under the target index field, the index data insertion method may be different for different data structure types of the target index field.

[0117] In an optional embodiment, the field value to be updated is used to update the index field value under the target index field in the index document to be updated, including: if the data structure type of the target index field is an atomic structure type, the field value to be updated is used to replace the index field value under the target index field in the index document to be updated.

[0118] Exemplarily, if the data structure type of the target index field is an atomic structure type, a direct replacement method can be used to directly replace the index field value under the target index field in the index document to be updated with the field value to be updated, so as to update the index data of the atomic structure type.

[0119] This optional embodiment realizes the update of index data when the data structure type of the target index field is an atomic structure type by directly replacing the index field value under the target index field in the index document to be updated with the field value to be updated, thereby improving the update efficiency and accuracy of the index data.

[0120] In another optional embodiment, the index field value under the target index field in the index document to be updated is updated using the field value to be updated, including: if the data structure type of the target index field is a composite structure type, determining the data insertion method corresponding to the composite structure type; according to the field value to be updated, based on the data insertion method, updating the index field value under the target index field in the index document to be updated.

[0121] Exemplarily, if the data structure type of the target index field is a composite structure type, the data insertion method corresponding to the composite structure type is determined. Among them, the data insertion methods corresponding to different composite structure types may be the same or different, and may be pre-set by relevant technical personnel according to actual needs. For example, data of an array structure type may be inserted using the add insertion method, and data of a map structure type may be inserted using the put insertion method. Different data insertion methods are used for different composite structure types to improve the data insertion efficiency of the composite structure type. Using the data insertion method corresponding to the composite structure type, the field value to be updated is inserted into the index field value under the target index field to implement data updates for the index document to be updated.

[0122] This optional embodiment determines the data insertion method corresponding to the composite structure type, and updates the index field value under the target index field in the index document to be updated based on the data insertion method according to the field value to be updated, thereby realizing the update of index data when the data structure type of the target index field is a composite structure type, thereby improving the updating efficiency and accuracy of the index data.

[0123] The technical solution of this embodiment determines whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated; if so, determines whether the field value to be updated is consistent with the index field value under the target index field; if not, uses the field value to be updated to update the index field value under the target index field in the index document to be updated. The above technical solution further improves the accuracy of updating the index data and the efficiency of updating the index data by considering different data update scenarios in the process of updating the index field value and using different data update methods in different data update scenarios.

[0124] Embodiment 3

[0125] Figure 3 This is a flow chart of an index data updating method provided in Embodiment 3 of the present invention. This embodiment provides a preferred example based on the above embodiments.

[0126] like Figure 3 As shown, the method comprises the following specific steps:

[0127] S301: Acquire data to be updated, and determine the index document to be updated corresponding to the data to be updated.

[0128] S302: Determine target index fields in the to-be-updated index document that correspond to the to-be-updated fields in the to-be-updated data.

[0129] S303: Construct a reference update field corresponding to the field to be updated.

[0130] S304A: If the data structure type of the target index field corresponding to the field to be updated is an atomic structure type, the field value to be updated of the field to be updated is determined as the reference field value of the reference update field corresponding to the field to be updated.

[0131] S304B: If the data structure type of the target index field corresponding to the field to be updated is a composite structure type, determine a target data conversion method corresponding to the composite structure type.

[0132] S305 . According to the target data conversion method, perform data structure conversion on the field value to be updated of the field to be updated to obtain a converted field value.

[0133] S306: Determine the converted field value as the reference field value of the reference update field corresponding to the field to be updated.

[0134] S307. Determine whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated; if so, execute S308A; if not, execute S308B.

[0135] S308A: Determine whether the field value to be updated is consistent with the index field value under the target index field. If yes, execute S309A; if no, execute S309B or S309C-S309D.

[0136] S308B: Add the reference field value of the reference update field to the target index field to update the index field value of the index document to be updated.

[0137] S309A: There is no need to update the index field value under the target index field.

[0138] S309B: If the data structure type of the target index field is an atomic structure type, the field value to be updated is used to replace the index field value under the target index field in the index document to be updated.

[0139] S309C: If the data structure type of the target index field is a composite structure type, determine the data insertion method corresponding to the composite structure type.

[0140] S309D. According to the field value to be updated and based on the data insertion method, update the index field value under the target index field in the index document to be updated.

[0141] Embodiment 4

[0142] Figure 4 The present invention provides a schematic diagram of the structure of an index data updating device provided in the fourth embodiment of the present invention. The present invention provides an index data updating device, which is applicable to the case of updating the index data in the index document. The index data updating device can be implemented in the form of hardware and / or software, such as Figure 4 As shown, the device specifically includes: a to-be-updated data acquisition module 401, an index field determination module 402, a reference field construction module 403, a reference field value determination module 404 and an index data update module 405. Among them,

[0143] The to-be-updated data acquisition module 401 is used to acquire the to-be-updated data and determine the to-be-updated index document corresponding to the to-be-updated data;

[0144] An index field determination module 402 is used to determine target index fields in the to-be-updated index document that correspond to the to-be-updated fields in the to-be-updated data;

[0145] A reference field construction module 403 is used to construct a reference update field corresponding to the field to be updated;

[0146] A reference field value determination module 404 is used to determine the reference field value of the reference update field corresponding to the to-be-updated field according to the to-be-updated field value of the to-be-updated field and based on the data structure type of the target index field corresponding to the to-be-updated field;

[0147] The index data updating module 405 is used to update the index field value of the to-be-updated index document according to the to-be-updated field value of the to-be-updated field and the reference field value of the reference update field.

[0148] The technical solution of the embodiment of the present invention obtains the data to be updated and determines the index document to be updated corresponding to the data to be updated; determines the target index fields in the index document to be updated that correspond to the fields to be updated in the data to be updated; constructs the reference update fields corresponding to the fields to be updated; determines the reference field value of the reference update field corresponding to the field to be updated based on the field value to be updated of the field to be updated and the data structure type of the target index field corresponding to the field to be updated; updates the index field value of the index document to be updated based on the field value to be updated of the field to be updated and the reference field value of the reference update field. The above technical solution realizes the accurate update of the index data by considering the data structure type of the target index field corresponding to the field to be updated in the process of updating the index data; by introducing and constructing the reference update field corresponding to the field to be updated, and combining the reference update field to realize the update of the index data, the update time of the index data is reduced, thereby improving the update efficiency of the index data.

[0149] Optionally, the reference field value determination module 404 includes:

[0150] The first reference value determining unit is used to determine the to-be-updated field value of the to-be-updated field as the reference field value of the reference update field corresponding to the to-be-updated field if the data structure type of the target index field corresponding to the to-be-updated field is an atomic structure type.

[0151] Optionally, the reference field value determination module 404 includes:

[0152] a conversion mode determining unit, configured to determine a target data conversion mode corresponding to the composite structure type if the data structure type of the target index field corresponding to the field to be updated is a composite structure type;

[0153] a conversion field value determination unit, configured to perform data structure conversion on the to-be-updated field value of the to-be-updated field according to the target data conversion mode, to obtain a conversion field value;

[0154] The second reference value determining unit is configured to determine the conversion field value as a reference field value of a reference update field corresponding to the field to be updated.

[0155] Optionally, the index data updating module 405 includes:

[0156] An index field value determination unit, used to determine whether there is an index field value under a target index field corresponding to the field to be updated in the index document to be updated;

[0157] a consistency judgment unit, configured to determine whether the to-be-updated field value is consistent with the index field value under the target index field if there is an index field value;

[0158] The index data updating unit is used to update the index field value under the target index field in the to-be-updated index document by using the to-be-updated field value if the to-be-updated field value is inconsistent with the index field value under the target index field.

[0159] Optionally, the index data updating module 405 further includes:

[0160] An index data adding unit is used to, after determining whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated, add the reference field value of the reference update field to the target index field if it is determined that there is no index field value under the target index field corresponding to the field to be updated in the index document to be updated, so as to update the index field value of the index document to be updated.

[0161] Optionally, the index data updating unit includes:

[0162] The first data updating subunit is used to replace the index field value under the target index field in the index document to be updated with the field value to be updated if the data structure type of the target index field is an atomic structure type.

[0163] Optionally, the index data updating unit includes:

[0164] an insertion mode determination subunit, for determining a data insertion mode corresponding to the composite structure type if the data structure type of the target index field is a composite structure type;

[0165] The second data updating subunit is used to update the index field value under the target index field in the index document to be updated according to the field value to be updated and based on the data insertion method.

[0166] The index data updating device provided in the embodiment of the present invention can execute the index data updating method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0167] Embodiment 5

[0168] Figure 5A schematic diagram of an electronic device 50 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0169] like Figure 5 As shown, the electronic device 50 includes at least one processor 51, and a memory connected to the at least one processor 51 in communication, such as a read-only memory (ROM) 52, a random access memory (RAM) 53, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 51 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 52 or the computer program loaded from the storage unit 58 to the random access memory (RAM) 53. In the RAM 53, various programs and data required for the operation of the electronic device 50 can also be stored. The processor 51, the ROM 52, and the RAM 53 are connected to each other via a bus 54. An input / output (I / O) interface 55 is also connected to the bus 54.

[0170] A number of components in the electronic device 50 are connected to the I / O interface 55, including: an input unit 56, such as a keyboard, a mouse, etc.; an output unit 57, such as various types of displays, speakers, etc.; a storage unit 58, such as a disk, an optical disk, etc.; and a communication unit 59, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 59 allows the electronic device 50 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0171] The processor 51 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 51 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 51 executes the various methods and processes described above, such as the index data update method.

[0172] In some embodiments, the index data update method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 58. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 50 via the ROM 52 and / or the communication unit 59. When the computer program is loaded into the RAM 53 and executed by the processor 51, one or more steps of the index data update method described above may be performed. Alternatively, in other embodiments, the processor 51 may be configured to perform the index data update method in any other appropriate manner (e.g., by means of firmware).

[0173] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0174] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0175] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0176] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0177] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0178] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0179] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0180] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for updating index data, characterized in that: include: Acquire the data to be updated, and determine the index document to be updated corresponding to the data to be updated; Determine target index fields in the to-be-updated index document that correspond to the to-be-updated fields in the to-be-updated data; Constructing a reference update field corresponding to the field to be updated; Determine, according to the to-be-updated field value of the to-be-updated field and based on the data structure type of the target index field corresponding to the to-be-updated field, the reference field value of the reference update field corresponding to the to-be-updated field; According to the to-be-updated field value of the to-be-updated field and the reference field value of the reference update field, data updating is performed on the index field value of the to-be-updated index document; The updating of the index field value of the to-be-updated index document according to the to-be-updated field value of the to-be-updated field and the reference field value of the reference update field comprises: Determine whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated; If so, determining whether the to-be-updated field value is consistent with the index field value under the target index field; If not, then using the to-be-updated field value to update the index field value under the target index field in the to-be-updated index document; The adopting the to-be-updated field value to update the index field value under the target index field in the to-be-updated index document includes: If the data structure type of the target index field is a composite structure type, determining a data insertion method corresponding to the composite structure type; According to the to-be-updated field value and based on the data insertion method, the index field value under the target index field in the to-be-updated index document is updated.

2. The method according to claim 1, characterized in that The determining, according to the to-be-updated field value of the to-be-updated field and based on the data structure type of the target index field corresponding to the to-be-updated field, the reference field value of the reference update field corresponding to the to-be-updated field comprises: If the data structure type of the target index field corresponding to the to-be-updated field is an atomic structure type, the to-be-updated field value of the to-be-updated field is determined as the reference field value of the reference update field corresponding to the to-be-updated field.

3. The method according to claim 1, characterized in that The determining, according to the to-be-updated field value of each to-be-updated field and based on the data structure type of the target index field corresponding to the corresponding to-be-updated field, the reference field value of the reference update field corresponding to each to-be-updated field comprises: If the data structure type of the target index field corresponding to the field to be updated is a composite structure type, determining a target data conversion method corresponding to the composite structure type; According to the target data conversion method, performing data structure conversion on the to-be-updated field value of the to-be-updated field to obtain a converted field value; The converted field value is determined as a reference field value of a reference update field corresponding to the field to be updated.

4. The method according to claim 1, characterized in that After determining whether there is an index field value under the target index field corresponding to the field to be updated in the index document to be updated, the method further includes: If it is determined that there is no index field value under the target index field corresponding to the field to be updated in the index document to be updated, the reference field value of the reference update field is added to the target index field to update the index field value of the index document to be updated.

5. The method according to claim 1, characterized in that The adopting the to-be-updated field value to update the index field value under the target index field in the to-be-updated index document includes: If the data structure type of the target index field is an atomic structure type, the to-be-updated field value is used to replace the index field value under the target index field in the to-be-updated index document.

6. An index data updating device, characterized in that: include: The to-be-updated data acquisition module is used to acquire the to-be-updated data and determine the to-be-updated index document corresponding to the to-be-updated data; An index field determination module, used to determine target index fields in the to-be-updated index document that correspond to the to-be-updated fields in the to-be-updated data; A reference field construction module, used to construct a reference update field corresponding to the field to be updated; A reference field value determination module, configured to determine a reference field value of a reference update field corresponding to the field to be updated according to the field value to be updated of the field to be updated and based on a data structure type of a target index field corresponding to the field to be updated; An index data updating module, used for updating the index field value of the to-be-updated index document according to the to-be-updated field value of the to-be-updated field and the reference field value of the reference update field; The index data updating module comprises: An index field value determination unit, used to determine whether there is an index field value under a target index field corresponding to the field to be updated in the index document to be updated; a consistency judgment unit, configured to determine whether the to-be-updated field value is consistent with the index field value under the target index field if there is an index field value; An index data updating unit, configured to update the index field value under the target index field in the index document to be updated by using the field value to be updated if the field value to be updated is inconsistent with the index field value under the target index field; The index data updating unit further includes: an insertion mode determination subunit, for determining a data insertion mode corresponding to the composite structure type if the data structure type of the target index field is a composite structure type; The second data updating subunit is used to update the index field value under the target index field in the index document to be updated according to the field value to be updated and based on the data insertion method.

7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the index data updating method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the index data updating method according to any one of claims 1 to 5 when executed.

Citation Information

Patent Citations

  • Timestamp-based ElasticSearch index creating and updating system and method

    CN116383216A

  • Data synchronization method and device, storage medium and electronic equipment

    CN116737829A