Retrieval method and device for custom field of SaaS (Software as Service) system

By providing custom field search methods in the SaaS system, the problems of high cost and poor timeliness of data synchronization from Mysql to Elasticsearch are solved, and efficient and stable multi-tenant custom retrieval is achieved, reducing costs and resource waste, and enhancing the problem of high-quality data synchronization costs and poor timeliness. System stability and data timeliness.

CN119415520APending Publication Date: 2025-02-11BEIJING HESI HUIZHI INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411467998.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

When synchronizing json data from Mysql to Elasticsearch, the existing technology has high costs, poor data timeliness, poor system stability, uncontrollable data synchronization granularity, serious resource waste, and there are problems such as conflicts in the same name field type.

Method used

Provide a search method for custom fields in SaaS system. By receiving search instructions from the target tenant, matching the search status of the tenant, and filtering data that meets the search conditions from Elasticsearch, realizing efficient custom field retrieval. This method does not require the introduction of third-party message synchronization components, which reduces resource deployment and operation and maintenance costs, enhances system stability, and searches through tenant custom fields, saving storage costs and transmission packet size, and improving update and insertion efficiency .

Benefits of technology

It realizes efficient and stable multi-tenant custom retrieval in SaaS system, reduces cost and resource waste, enhances system stability and data timeliness, and avoids conflicts in the same name field type.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415520A_ABST
    Figure CN119415520A_ABST
Patent Text Reader

Abstract

The invention provides a retrieval method and device for a custom field of an SaaS system, and relates to the technical field of data retrieval, and the method comprises the steps: receiving a retrieval instruction sent by a target tenant in the SaaS system; matching a target retrieval state corresponding to the target tenant from the configured tenant retrieval state set; if the target retrieval state is in retrieval, matching a target json data table to be retrieved corresponding to the unique identification code from the configured Elasticsearch; and from the target to-be-retrieved json data table, screening data meeting retrieval conditions in the fields with the set indexes to obtain target retrieval data. According to the method, retrieval is carried out based on the user-defined fields of the tenants, and the tenants can flexibly, dynamically and online adjust the user-defined fields; and meanwhile, all fields do not need to be written into Elasticsearch, so that the storage cost is saved, the size of a transmitted data packet is reduced, and the updating and inserting efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data retrieval technology, and in particular to a method and device for retrieving custom fields in a SaaS system. Background Art

[0002] In business scenarios where custom fields are loaded using json structures, Mysql is used to store json to solve transaction problems, and Elasticsearch is used to store json to solve retrieval problems, a new table is generally created in Mysql, a JSON type field is added to the table, and the tenant's custom fields will be stored in this JSON type field. At the same time, a log synchronization component (such as canal) and a message component (such as kafka) are introduced, and a message consumption service is built. When the business writes JSON to Mysql, binlog is generated. The log synchronization component will listen to the binlog and send it to the message component. The message consumption service will always listen to the consumption component. When a message comes, it will parse the message body to read the JSON data, and then write it to Elasticsearch. Using the automatic index creation feature of Elasticsearch, the mapping structure is automatically generated.

[0003] However, the above technology has the following problems: First, the cost is high. When synchronizing json data from Mysql to Elasticsearch, it is necessary to spend extra money to build a log synchronization component, and this component also requires operation and maintenance personnel to spend money on operation and supervision. Second, the data timeliness is poor. When Mysql has a large master-slave delay, log synchronization will also be delayed, resulting in a large delay when actually writing to Elasticsearch.

[0004] Third, the system is unstable. The log synchronization service actually monitors the binlog generated by MySQL. If a huge binlog is generated due to improper operation, it is very likely to crash the log synchronization service and make the entire system unavailable. Fourth, the data synchronization granularity is uncontrollable, because the generation of binlog is based on the change of MySQL table records. Its smallest granularity is the row record of MySQL, and it cannot be synchronized further by column field.

[0005] The fifth is a huge waste of resources, because the automatic index creation feature of Elasticsearch will automatically generate mapping when json is written to Elasticsearch. But in fact, json is customized by the customer, and not all customized fields are what the customer needs to search, so it causes a huge waste of resources.

[0006] The sixth is the type conflict of fields with the same name. Because the fields in JSON are customized by tenants, it is possible that tenant A created json1, which has a field called code, which is a string type. Tenant B created json2, which also has a field called code, which is a numeric type. However, when json1 and json2 are written to Elasticsearch at the same time, the writing will fail because the types of the fields with the same name are different. Summary of the invention

[0007] The purpose of the embodiments of the present application is to provide a method and device for retrieving custom fields in a SaaS system, so as to solve the above-mentioned problems existing in the prior art and realize multi-tenant custom retrieval efficiently and stably.

[0008] In a first aspect, a method for retrieving a custom field of a SaaS system is provided, and the method may include:

[0009] Receiving a search instruction sent by a target tenant in the SaaS system; wherein the search instruction includes: a unique identification code of the target tenant and a configured search condition;

[0010] Matching the target search status corresponding to the target tenant from the configured tenant search status set; wherein the tenant search status set pre-stores the unique identification codes of different target tenants and the corresponding search status; the search status includes searching;

[0011] If the target search status is searching, the target to-be-searched json data table corresponding to the unique identification code is matched from the configured Elasticsearch; wherein different target tenants and corresponding to-be-searched json data tables are pre-stored in Elasticsearch; the target to-be-searched json data table contains indexed fields and corresponding data; the indexed fields are the to-be-searched fields customized by the target tenant;

[0012] From the target json data table to be searched, filter the data that meets the search condition in the indexed field to obtain the target search data.

[0013] In an optional implementation, the SaaS system is further provided with a relational database; the relational database stores different target tenants and corresponding json data tables to be retrieved;

[0014] The search status also includes not searching.

[0015] In an optional implementation, the method further includes:

[0016] If the search status of the target tenant is not in search, target search data is filtered from the relational database based on the unique identification code and the search condition.

[0017] In an optional implementation, the method further includes:

[0018] Get target update data;

[0019] Based on the target update data, the json data table to be retrieved in the Elasticsearch and the json data table to be retrieved in the relational database are synchronously updated.

[0020] In an optional implementation, the method further includes:

[0021] When the to-be-searched json data table in the Elasticsearch is updated, the search status corresponding to the target tenant in the tenant search status set is changed to non-searching.

[0022] In an optional implementation, after updating the to-be-retrieved json data table in the Elasticsearch, the method further includes:

[0023] The search status corresponding to the target tenant in the tenant search status set is changed to searching.

[0024] In a second aspect, a device for searching a custom field of a SaaS system is provided, and the device may include:

[0025] A receiving unit, configured to receive a search instruction sent by a target tenant in a SaaS system; wherein the search instruction includes: a unique identification code of the target tenant and a configured search condition;

[0026] A retrieval unit is used to match the target retrieval status corresponding to the target tenant from the configured tenant retrieval status set; wherein the tenant retrieval status set pre-stores unique identification codes and corresponding retrieval statuses of different target tenants; the retrieval status includes searching; if the target retrieval status is searching, the target to-be-retrieved json data table corresponding to the unique identification code is matched from the configured Elasticsearch; wherein different target tenants and corresponding to-be-retrieved json data tables are pre-stored in Elasticsearch; the target to-be-retrieved json data table contains indexed fields and corresponding data; the indexed fields are customized to-be-retrieved fields of the target tenant; from the target to-be-retrieved json data table, the data that meets the retrieval conditions in the indexed fields are screened to obtain the target retrieval data.

[0027] In a third aspect, an electronic device is provided, the electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0028] Memory, used to store computer programs;

[0029] The processor is used to implement any method step described in the first aspect when executing the program stored in the memory.

[0030] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.

[0031] This application does not introduce third-party message synchronization components (maxwell, canal, etc.) during the data synchronization process from relational database to Elasticsearch, which reduces resource deployment costs and operation and maintenance costs and enhances system stability.

[0032] This application is based on tenant-defined fields for retrieval. Tenants can freely select the fields they want to retrieve without having to write all fields into Elasticsearch, which saves storage costs, reduces the size of transmitted data packets, and improves the efficiency of updates and insertions. At the same time, tenants can flexibly, dynamically, and online adjust custom fields according to their actual needs without affecting normal online business.

[0033] The index of this application in Elasticsearch is created according to the tenant dimension. The index generation rule is based on tenant + table name, so each tenant in the same table has its own index, which better supports the tenant data isolation required by the SaaS system. In addition, through tenant index isolation, the risk of field explosion in Elasticsearch is greatly reduced, and the conflict problem of fields with the same name is fundamentally avoided.

[0034] This application uses query routing control to support tenants to adjust custom fields involved in retrieval in real time and online without affecting customer use. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 A flowchart of a method for retrieving custom fields in a SaaS system provided in an embodiment of the present application;

[0037] Figure 2 A flowchart of a custom table of data to be retrieved provided in an embodiment of the present application;

[0038] Figure 3 A flowchart of Elasticsearch and relational database data synchronization provided in an embodiment of the present application;

[0039] Figure 4 A flowchart of data synchronization update in Elasticsearch provided in an embodiment of the present application;

[0040] Figure 5 A flowchart of dynamically controlling tenant query routing provided in an embodiment of the present application;

[0041] Figure 6 A flowchart of dynamically adjusting searchable custom fields provided in an embodiment of the present application;

[0042] Figure 7 A schematic diagram of the structure of a retrieval device for a custom field in a SaaS system provided in an embodiment of the present application;

[0043] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0045] The retrieval method for custom fields of SaaS system provided in the embodiment of the present application can be applied in a server or in a terminal with strong computing power. The server can be a physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal can be a user equipment (User Equipment, UE) such as a mobile phone, a smart phone, a laptop, a digital broadcast receiver, a personal digital assistant (PDA), a tablet computer (PAD), a handheld device, a vehicle-mounted device, a wearable device, a computing device or other processing equipment connected to a wireless modem, a mobile station (Mobile Station, MS), a mobile terminal (Mobile Terminal), etc. The terminal and the server can be directly or indirectly connected by wired or wireless communication, which is not limited in this application.

[0046] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0047] Figure 1 The present invention provides a flowchart of a method for retrieving a custom field in a SaaS system. Figure 1 As shown, the method may include:

[0048] Step S110: receiving a search instruction sent by a target tenant in the SaaS system; and matching a target search state corresponding to the target tenant from a configured tenant search state set.

[0049] In an embodiment of the present application, a SaaS system with multiple tenants is provided with a relational database and Elasticsearch, each tenant corresponds to multiple data tables, and the multiple data tables corresponding to each tenant are stored in the relational database; the tenant selects a data table that expects to realize the retrieval function from the multiple data tables as the json data table to be retrieved; the tenant customizes the fields to be retrieved from their respective json data tables to be retrieved to create an index on the fields to be retrieved, thereby realizing the retrieval function; different target tenants and corresponding json data tables to be retrieved are stored in the relational database; the json data tables to be retrieved and the fields to be retrieved of different tenants may be the same or different.

[0050] In the embodiment of the present application, the relational data may be a MySQL database; the target tenant may be one or more.

[0051] In an embodiment of the present application, Elasticsearch also stores different target tenants and corresponding json data tables to be retrieved; the target json data tables to be retrieved contain indexed fields and corresponding data; the indexed fields are the fields to be retrieved customized by the target tenants.

[0052] In an embodiment of the present application, the search instruction includes: a unique identification code of the target tenant and a configured search condition.

[0053] In the embodiment of the present application, the tenant search status set includes the unique identification code of each tenant in the SaaS system and the corresponding search status; wherein the search status includes: not searching and searching; the non-searching includes: activated and unactivated. When the tenant's search status is activated, it means that the tenant is activating the search function (i.e., customizing the fields to be searched) or updating the fields to be searched.

[0054] In an embodiment of the present application, the search status of each tenant stored in the tenant search status set will be dynamically updated. When the tenant has completed the setting of the field to be searched, the search status of the tenant will be changed to searching, and Elasticsearch can be called for retrieval; when the tenant is updating the field to be searched or the search function has not yet been enabled, the search status of the tenant is not searching, and the relational database needs to be called for retrieval.

[0055] Step S120: If the target search status is the search status, match the target to-be-searched json data table corresponding to the unique identification code from the configured Elasticsearch.

[0056] In an embodiment of the present application, when the target search status is displayed as the search status in the tenant search status set, it means that Elasticsearch can be searched. At this time, the target search data can be filtered from the configured Elasticsearch based on the unique identification code and the search conditions.

[0057] In an embodiment of the present application, when the target retrieval status is displayed as an unretrieved status in the tenant retrieval status set, it means that Elasticsearch cannot perform the search at this time, so it is necessary to call the data table stored in the relational database for retrieval, and filter the target retrieval data from the configured relational database based on the unique identification code and retrieval conditions.

[0058] In actual applications, the data table in Elasticsearch cannot be retrieved when it is being edited. Therefore, this application monitors in real time whether the tenant edits the data table to be retrieved to determine whether the data table to be retrieved can be retrieved. When it can be retrieved, data is retrieved from Elasticsearch. When it cannot be retrieved, relational data is provided as an alternative retrieval database, thereby avoiding the impact on customer data calls due to the inability of Elasticsearch to retrieve.

[0059] Step S130: Filter the data that meets the search conditions in the indexed fields from the target json data table to be searched, and obtain the target search data.

[0060] In an embodiment of the present application, the method also includes: when data is updated, target update data is obtained; based on the target update data, the json data table to be retrieved in Elasticsearch and the json data table to be retrieved in the relational database are synchronously updated; and when the json data table to be retrieved in Elasticsearch is updated, the retrieval status corresponding to the target tenant in the tenant retrieval status set is changed to non-searching, and if a retrieval instruction is received at this time, the data in the relational database is retrieved; when the json data table to be retrieved in Elasticsearch is updated, the retrieval status corresponding to the target tenant in the tenant retrieval status set is changed to searching, and if a retrieval instruction is received at this time, the data is retrieved from Elasticsearch.

[0061] In one embodiment of the present application, a method for retrieving a custom field of a SaaS system includes the following steps:

[0062] First, the tenant selects a data table (i.e. determines the target json data table to be searched) and certain fields in the json in the table to enable search capabilities, i.e. sets the fields to be searched;

[0063] Secondly, the tenant-defined target json data table to be searched, the fields to be searched, and the corresponding data are stored in the relational databases Mysql and Elasticsearch;

[0064] Furthermore, consumption compensation information is used to keep the data in MySQL and Elasticsearch consistent;

[0065] Then, synchronize the existing data in the flow table to Elasticsearch;

[0066] Finally, dynamically control the query routing of tenants and dynamically adjust the searchable custom fields of tenants.

[0067] In the embodiments of the present application, Figure 2As shown, the tenant selects a data table (i.e., determines the target json data table to be searched) and certain fields in the json in the table to enable search capabilities, i.e., set the fields to be searched, including:

[0068] (1) Select the document table flow as the target json data table to be retrieved. The structure of the document table flow is as follows:

[0069] CREATE TABLE `flow`(

[0070] `jn`json NOT NULL,

[0071] `id`varchar(50)CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,

[0072] PRIMARY KEY (`id`)

[0073] )ENGINE=InnoDB DEFAULT CHARSET=utf8mb4COLLATE=utf8mb4_unicode_ci;

[0074] The document table records the document records submitted by tenants in the SaaS system. Each tenant's bill of lading record will be stored in this table.

[0075] When tenants submit documents in the system, they can customize the fields on the form. Suppose there is a tenant X, whose tenant id is abc, and the tenant customizes 3 form fields:

[0076]

[0077] Tenant X submits a document based on a custom field, and the document will be saved by the system in the MySQL flow table, as shown below:

[0078]

[0079] Based on the definition of the flow table above, we can see that the table has only two fields, id and jn. The fields customized by tenant X will be inserted inside the jn field type.

[0080] (2) Tenant X specifies that the flow table has the custom field search capability enabled. At this time, the SaaS system will create a new collection and use the table name flow as the collection name. The collection stores the tenant ID and activation status of the tenant that has enabled the custom field search capability of the flow table. The tenant's activation status has two statuses: PROCESSING and DONE, which represent activation in progress and activation completed. When it is first activated, the status is PROCESSING. So the content of the collection SET should be [abc:PROCESSING]. Then, the collection name flow and the collection content [abc:PROCESSING] need to be stored in Redis in the form of key-value, with flow as the key and [abc:PROCESSING] as the value.

[0081] (3) Define an activation status query capability, which uses the tenant id and table name to determine whether the tenant has activated the retrieval capability of the custom field of the table. There are three return results: not activated, PROCESSING, and DONE. The specific judgment logic is to use the table name as the key of redis to query redis and return the value. Then query the activation status in the value according to the tenant and return it. For example, when querying the activation status of tenant X in the flow table, first use the table name flow as the key to query redis and return the value: [abc:PROCESSING]. According to the tenant id of tenant X: abc, query the value to get the status of PROCESSING and return it.

[0082] (4) Define an activation status update function, which can specify the activation status of the custom field retrieval capability of a table for a tenant in the update collection to DONE. For example, the content of the collection flow is: [abc:PROCESSING]. When calling the activation status update function S14, the content of the flow can be updated to [abc:DONE];

[0083] (5) Tenants can select custom fields as search conditions. For example, tenant X can select title and code in the flow table as search fields. The type of the field needs to be recorded at the same time. This structure can be recorded as a struct, as follows:

[0084] {

[0085] "corporationId":{

[0086] "type":"String"

[0087] },

[0088] "title":{

[0089]

[0090] }. This indicates that tenant X has enabled the custom field search capability of the flow table, and only supports the search capability of the three fields of the flow table: corporationId, title, and code. Then a key is generated based on the tenant id: abc and the table name flow. The rule is tenant id: table name, that is, key = abc:flow. Then<key,value> The key-value pair is stored in Redis. The key is abc:flow and the value is a structure struct.

[0091] (6) Define a custom search field query capability, generate a key using the tenant id and table name, and follow the rule of tenant id: table name. Then query redis using the key to get the result value and return it.

[0092] In the embodiments of the present application, Figure 3 As shown in the figure, the tenant-defined target json data table to be searched, the fields to be searched, and the corresponding data are stored in the relational database Mysql and Elasticsearch, including:

[0093] Assume that a tenant submits a document and generates a new flow record. It is recorded as:

[0094]

[0095] Now we need to write the record to Mysql and Elasticsearch;

[0096] Start a database transaction in the application code, write down the transaction ID, and create a transaction set S; create a set with transactionID as the name of the set; prepare the MySQL insert statement and insert into flow setid=....,jn=...; extract the database primary key id and jn values ​​from the insert statement, and write the primary key id into the set S; extract the tenant id, i.e. corporateId=abc and the table name flow, from jn, call the S13 capability to ensure that the enterprise has enabled the custom field search function; execute the insert statement to write the document record into the flow table; query the custom fields that support search enabled by the enterprise, recorded as filters; extract the fields defined by filters from jn and generate new docs; generate the Elasticsearch index name based on the tenant id and table name, and the generation rule is table name_tenant id, i.e.: flow_abc; call the Elasticsearch API to write the docs into the Elasticsearch index flow_abc; commit the database transaction, if the commit succeeds, clear the set S; if the commit fails, extract the primary key id from the set S, and then generate a compensation message, the message content includes: tenant id, table name, primary key id. Send the message to the message middleware; if Elasticsearch fails to write, parse the docs and generate a compensation message. The message content includes: tenant id, table name, primary key id, and send the message to the message middleware.

[0097] In the embodiment of the present application, consumption compensation information is used to keep the data in Mysql and Elasticsearch consistent, including:

[0098] Deploy the downstream consumption service of the message middleware; subscribe to and consume compensation messages, parse the message body, and obtain the tenant id, table name, and primary key id; generate query SQL, select id, jn from flow where id in (primary key id); query the custom fields that support retrieval enabled by the enterprise, recorded as filters; according to the filter definition, extract from the results returned by S33 and generate new docs; call the Elasticsearch API to write docs to the index flow_abc. If the writing fails, parse the docs and generate a compensation message. The message content includes: tenant id, table name, primary key id, and send the message to the message middleware.

[0099] In the embodiments of the present application, Figure 4As shown, synchronize the flow table inventory data to Elasticsearch, including:

[0100] Read the full data from the Mysql flow table in batches according to the tenant dimension; query the custom fields that support retrieval enabled by the enterprise, recorded as filters; generate a new dcos based on the full data read according to the filters definition; call the Elasticsearch API to write docs to the index flow_abc. If the write fails, parse the docs and generate a compensation message. The message content includes: tenant id, table name, primary key id, and send the message to the message middleware; update the flow table activation status of tenant abc to DONE.

[0101] In the embodiments of the present application, Figure 5 As shown, dynamically control the query routing of tenants, including:

[0102] According to the tenant ID and table name, the activation status of the tenant's custom field retrieval capability is determined; if the activation status is DONE, when the program queries the flow table data, it will query the data in the flow_abc index of Elasticsearch; if the activation status is not DONE, it will query the data in the Mysql flow table.

[0103] In the embodiments of the present application, Figure 6 As shown, tenants can dynamically adjust the searchable custom fields, including:

[0104] Tenants can add and delete custom fields and flexibly adjust the tenant's custom field retrieval configuration; update the flow table activation status of tenant abc to PROCESSING, and all queries will go to the Mysql flow table for query; delete the flow_abc index of Elasticsearch and synchronize the existing data of the flow table to Elasticsearch.

[0105] Corresponding to the above method, the present application embodiment also provides a retrieval device for a custom field of a SaaS system, such as Figure 7 As shown, the retrieval device for the custom field of the SaaS system includes:

[0106] The receiving unit 710 is used to receive a search instruction sent by a target tenant in the SaaS system; wherein the search instruction includes: a unique identification code of the target tenant and a configured search condition;

[0107] The retrieval unit 720 is used to match the target retrieval status corresponding to the target tenant from the configured tenant retrieval status set; wherein the tenant retrieval status set pre-stores the unique identification codes and corresponding retrieval status of different target tenants; the retrieval status includes retrieving; if the target retrieval status is retrieving, the target to-be-retrieved json data table corresponding to the unique identification code is matched from the configured Elasticsearch; wherein different target tenants and corresponding to-be-retrieved json data tables are pre-stored in Elasticsearch; the target to-be-retrieved json data table contains indexed fields and corresponding data; the indexed fields are customized to-be-retrieved fields of the target tenant; from the target to-be-retrieved json data table, the data that meets the retrieval conditions in the indexed fields are filtered to obtain the target retrieval data.

[0108] The functions of the various functional units of the retrieval device for custom fields of a SaaS system provided in the above-mentioned embodiments of the present application can be implemented through the above-mentioned method steps. Therefore, the specific working process and beneficial effects of each unit in the retrieval device for custom fields of a SaaS system provided in the embodiments of the present application are not repeated here.

[0109] The present application also provides an electronic device, such as Figure 8 As shown, it includes a processor 810 , a communication interface 820 , a memory 830 and a communication bus 840 , wherein the processor 810 , the communication interface 820 , and the memory 830 communicate with each other via the communication bus 840 .

[0110] Memory 830, used for storing computer programs;

[0111] The processor 810 is used to execute the program stored in the memory 830 to implement the following steps:

[0112] Receiving a search instruction sent by a target tenant in the SaaS system; wherein the search instruction includes: a unique identification code of the target tenant and a configured search condition;

[0113] From the configured tenant retrieval status set, match the target retrieval status corresponding to the target tenant; wherein the tenant retrieval status set pre-stores the unique identification codes and corresponding retrieval status of different target tenants; the retrieval status includes searching; if the target retrieval status is searching, match the target to-be-retrieved json data table corresponding to the unique identification code from the configured Elasticsearch; wherein Elasticsearch pre-stores different target tenants and the corresponding to-be-retrieved json data tables; the target to-be-retrieved json data table contains indexed fields and corresponding data; the indexed fields are the to-be-retrieved fields customized by the target tenant; from the target to-be-retrieved json data table, filter the data that meets the retrieval conditions in the indexed fields to obtain the target retrieval data.

[0114] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0115] The communication interface is used for communication between the above electronic device and other devices.

[0116] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0117] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0118] The implementation methods and beneficial effects of the components of the electronic device in the above embodiments to solve the problems can be seen in Figure 1 The various steps in the illustrated embodiment are implemented, therefore, the specific working process and beneficial effects of the electronic device provided by the embodiment of the present application are not repeated here.

[0119] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is executed on a computer, the computer executes any one of the methods for retrieving custom fields for a SaaS system in the above embodiments.

[0120] In another embodiment provided by the present application, a computer program product including instructions is also provided. When the computer program product is executed on a computer, the computer executes any one of the methods for retrieving custom fields for a SaaS system in the above embodiments.

[0121] Those skilled in the art will appreciate that the embodiments in the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt a complete hardware embodiment, a complete software embodiment, or a form of an embodiment combining software and hardware. Moreover, the present application may adopt a form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0122] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0123] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0124] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0125] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present application.

[0126] Obviously, those skilled in the art can make various changes and modifications to the embodiments in the present application without departing from the spirit and scope of the embodiments in the present application. Thus, if these modifications and variations of the embodiments in the present application fall within the scope of the claims and their equivalents in the embodiments of the present application, the embodiments of the present application are also intended to include these modifications and variations.

Claims

1. A method for retrieving custom fields in a SaaS system, characterized in that: The method comprises: Receiving a search instruction sent by a target tenant in the SaaS system; wherein the search instruction includes: a unique identification code of the target tenant and a configured search condition; Matching the target search status corresponding to the target tenant from the configured tenant search status set; wherein the tenant search status set pre-stores the unique identification codes of different target tenants and the corresponding search status; the search status includes searching; If the target search status is searching, the target to-be-searched json data table corresponding to the unique identification code is matched from the configured Elasticsearch; wherein different target tenants and corresponding to-be-searched json data tables are pre-stored in Elasticsearch; the target to-be-searched json data table contains indexed fields and corresponding data; the indexed fields are the to-be-searched fields customized by the target tenant; From the target json data table to be searched, the data that meets the search condition in the indexed field is screened to obtain the target search data.

2. The method according to claim 1, characterized in that The SaaS system is also provided with a relational database; the relational database stores different target tenants and corresponding json data tables to be retrieved; The search status also includes not searching.

3. The method according to claim 2, characterized in that The method further comprises: If the search status of the target tenant is not in search, target search data is filtered from the relational database based on the unique identification code and the search condition.

4. The method according to claim 2, characterized in that The method further comprises: Get target update data; Based on the target update data, the json data table to be retrieved in the Elasticsearch and the json data table to be retrieved in the relational database are synchronously updated.

5. The method according to claim 4, characterized in that The method further comprises: When the to-be-searched json data table in the Elasticsearch is updated, the search status corresponding to the target tenant in the tenant search status set is changed to non-searching.

6. The method according to claim 4, characterized in that After updating the json data table to be retrieved in the Elasticsearch, the method further includes: The search status corresponding to the target tenant in the tenant search status set is changed to searching.

7. A retrieval device for a custom field in a SaaS system, characterized in that: The device comprises: A receiving unit, configured to receive a search instruction sent by a target tenant in a SaaS system; wherein the search instruction includes: a unique identification code of the target tenant and a configured search condition; A retrieval unit is used to match the target retrieval status corresponding to the target tenant from the configured tenant retrieval status set; wherein the tenant retrieval status set pre-stores unique identification codes and corresponding retrieval statuses of different target tenants; the retrieval status includes searching; if the target retrieval status is searching, the target to-be-retrieved json data table corresponding to the unique identification code is matched from the configured Elasticsearch; wherein different target tenants and corresponding to-be-retrieved json data tables are pre-stored in Elasticsearch; the target to-be-retrieved json data table contains indexed fields and corresponding data; the indexed fields are customized to-be-retrieved fields of the target tenant; from the target to-be-retrieved json data table, the data that meets the retrieval conditions in the indexed fields are screened to obtain the target retrieval data.

8. An electronic device, characterized in that: The electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, used to implement any method described in claims 1-6 when executing a program stored in a memory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.