CN109145014A - The method and apparatus for generating elastic searching request - Google Patents
The method and apparatus for generating elastic searching request Download PDFInfo
- Publication number
- CN109145014A CN109145014A CN201710451970.7A CN201710451970A CN109145014A CN 109145014 A CN109145014 A CN 109145014A CN 201710451970 A CN201710451970 A CN 201710451970A CN 109145014 A CN109145014 A CN 109145014A
- Authority
- CN
- China
- Prior art keywords
- inquiry
- key word
- query language
- structured query
- object file
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2452—Query translation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2453—Query optimisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/06—Buying, selling or leasing transactions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/06—Buying, selling or leasing transactions
- G06Q30/0601—Electronic shopping [e-shopping]
- G06Q30/0623—Item investigation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Accounting & Taxation (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Databases & Information Systems (AREA)
- Finance (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
This application discloses the method and apparatus for generating elastic searching request.Wherein, a specific embodiment of this method includes: in response to detecting that the data inquiry request operation of elasticity search generates structured query language sentence by the parameter in Object Relation Mapping frame configuration data inquiry request;According to the mapping relations of structured query language order and executable object file, above structure query language statement is converted into executable object file;The grammer keyword in executable object file is replaced with into the grammer keyword that elasticity is searched in grammer according to default transformation rule;Executable object file after replacement grammer keyword is generated into elastic searching request.The validity of elasticity search can be improved in the embodiment.
Description
Technical field
This application involves field of computer technology, and in particular to Internet technical field, more particularly to generate elasticity search
The method and apparatus of request.
Background technique
Elasticity search, ElasticSearch, referred to as: ES, it is based on full-text search engine Lucene, provides distribution
The full-text search engine of multi-user capability, it is used for big data field of cloud calculation in design can reach real-time search.However,
ES has oneself specific grammer, and needing to understand its syntactic structure just using its people can control, with web developer in number
The SQL syntax difference of more familiar relational database is larger when according to retrieval, and the learning cost of developer is caused to increase.Therefore, existing
There is the validity of ES lower.
Summary of the invention
The purpose of the application is to propose a kind of improved method and apparatus for generating elastic searching request, more than solving
The technical issues of background technology part is mentioned.
In a first aspect, the embodiment of the present application provides a kind of method for generating elastic searching request, this method comprises: response
In the data inquiry request operation for detecting elasticity search, pass through the ginseng in Object Relation Mapping frame configuration data inquiry request
Number generates structured query language sentence;It, will according to the mapping relations of structured query language order and executable object file
Above structure query language statement is converted into executable object file;It will be in executable object file according to default transformation rule
Grammer keyword replace with elasticity search grammer in grammer keyword;By the executable file pair after replacement grammer keyword
As generating elastic searching request.
In some embodiments, the above-mentioned mapping relations according to structured query language order and executable object file,
It includes: the inquiry item in detection data inquiry request that above structure query language statement, which is converted into executable object file,
Part, wherein above-mentioned querying condition includes key word of the inquiry and condition value;By the key word of the inquiry and condition value of above-mentioned querying condition
Respectively as the label and attribute of executable object file, above structure query language statement is converted into executable file
Object.
In some embodiments, the key word of the inquiry of above-mentioned querying condition and condition value are transmitted in the form of key-value pair,
In, above-mentioned key assignments centering key is key word of the inquiry, is worth for the corresponding condition value of key word of the inquiry.
In some embodiments, the above-mentioned data inquiry request in response to detecting elasticity search operates, and is closed by object
It is the parameter in mapping framework configuration data inquiry request, generating structured query language sentence includes: in response to detecting bullet
Property search data inquiry request operation, according to data inquiry request operate detection data inquiry request key word of the inquiry;When
When above-mentioned key word of the inquiry has multiple, above-mentioned key word of the inquiry is spliced by default grammer, generates structured query language language
Sentence.
In some embodiments, above structure query language statement includes retrieval table name and key word of the inquiry, wherein on
The retrieval table name for stating structured query language sentence is consistent with elasticity search index name, above structure query language statement
Key word of the inquiry is consistent with the key word of the inquiry of elastic search language sentence.
Second aspect, present invention also provides a kind of device for generating elastic searching request, which includes: that sentence generates
Module is configured to configure in response to detecting the data inquiry request operation of elasticity search by Object Relation Mapping frame
Parameter in data inquiry request generates structured query language sentence;Conversion module is configured to according to structuralized query language
The mapping relations of speech order and executable object file, are converted into executable file pair for above structure query language statement
As;Replacement module is configured to that the grammer keyword in executable object file is replaced with elasticity according to default transformation rule
Search for the grammer keyword in grammer;Generation module is requested, is configured to that the executable file pair after grammer keyword will be replaced
As generating elastic searching request.
In some embodiments, above-mentioned conversion module includes: detection unit, is configured in detection data inquiry request
Querying condition, wherein above-mentioned querying condition includes key word of the inquiry and condition value;Converting unit is configured to above-mentioned inquiry
The key word of the inquiry and condition value of condition inquire above structure respectively as the label and attribute of executable object file
Language statement is converted into executable object file.
In some embodiments, the key word of the inquiry of above-mentioned querying condition and condition value are transmitted in the form of key-value pair,
In, above-mentioned key assignments centering key is key word of the inquiry, is worth for the corresponding condition value of key word of the inquiry.
In some embodiments, above-mentioned sentence generation module is further configured to: in response to detecting elasticity search
Data inquiry request operation, the key word of the inquiry of detection data inquiry request is operated according to data inquiry request;When above-mentioned inquiry
When keyword has multiple, above-mentioned key word of the inquiry is spliced by default grammer.
In some embodiments, above structure query language statement includes retrieval table name and key word of the inquiry, wherein on
The retrieval table name for stating structured query language sentence is consistent with elasticity search index name, above structure query language statement
Key word of the inquiry is consistent with the key word of the inquiry of elastic search language sentence.
The method and apparatus provided by the present application for generating elastic searching request, in response to detecting that the data of elasticity search are looked into
Request operation is ask, by the parameter in Object Relation Mapping frame configuration data inquiry request, generates structured query language language
Sentence, then according to the mapping relations of structured query language order and executable object file, by above structure query language
Sentence is converted into executable object file, then, according to default transformation rule by the grammer keyword in executable object file
The grammer keyword in elasticity search grammer is replaced with, then, the executable object file after replacement grammer keyword is generated
Elastic searching request.It is searched due to carrying out syntax conversion generation elasticity automatically in prior art basis by executable object file
Rope request, so as to improve the validity of elasticity search.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other
Feature, objects and advantages will become more apparent upon:
Fig. 1 is that this application can be applied to exemplary system architecture figures therein;
Fig. 2 is the flow chart according to one embodiment of the method for the elastic searching request of generation of the application;
Fig. 3 a, Fig. 3 b are the application scenarios signals that one embodiment of method of elastic searching request is generated according to the application
Figure;
Fig. 4 is the structural schematic diagram according to one embodiment of the device of the elastic searching request of generation of the application;
The structural representation of the computer system of terminal device or server that Fig. 5 is suitable for being used to realize the embodiment of the present application
Figure.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 is shown can be using the exemplary system frame of the embodiment of the method for the elastic searching request of generation of the application
Structure 100.
As shown in Figure 1, system architecture 100 may include terminal device 101,102, network 103 and server 104.Network
103 between terminal device 101,102 and server 104 to provide the medium of communication link.Network 103 may include various
Connection type, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 101,102 and be interacted by network 103 with server 104, be disappeared with receiving or sending
Breath etc..Various telecommunication customer end applications can be installed, such as browser application, shopping class are applied, searched on terminal device 101,102
The application of rope class, instant messaging tools etc..
Terminal device 101,102 can be the various electronic equipments with communication function, including but not limited to smart phone,
Tablet computer, E-book reader, pocket computer on knee and desktop computer etc..
Server 104 can be to provide the server of various services, such as answer the browser on terminal device 101,102
The background server etc. supported with offers such as, shopping class applications.Server 104 can inquiry or unlocking request etc. to receiving
Data carry out the processing such as analyzing, and processing result (such as the article pay status information inquired) is fed back to terminal device
101、102。
Generally, the method that elastic searching request is generated provided by the embodiment of the present application be suitable for terminal device 101,
102;Correspondingly, the device that elastic searching request is generated provided by the embodiment of the present application is set to terminal device 101,102.Clothes
Business device 104 can provide elasticity search and support, terminal device 101,102 can receive the searching request operation of user, and generate
Elastic searching request is sent to server 104, to obtain data from server 104.
It should be understood that the number of terminal device, network and server in Fig. 1 is only schematical.According to realization need
It wants, can have any number of terminal device, network and server.
With continued reference to Fig. 2, Fig. 2 shows one embodiment of the method for the elastic searching request of the generation of the application.The life
At the method for elastic searching request, comprising the following steps:
Step 201, in response to detecting that the data inquiry request of elasticity search operates, matched by Object Relation Mapping frame
The parameter in data inquiry request is set, structured query language sentence is generated.
In the present embodiment, it is (such as shown in FIG. 1 to generate the electronic equipment of the method operation of elastic searching request thereon
102) terminal device 101 can operate the data inquiry request of user and detect, when detecting to elastic search server
When carrying out the data inquiry request operation of data query, Object Relation Mapping (such as Object Relational can be passed through first
Mapping, ORM) parameter in frame configuration data inquiry request, generate structured query language sentence.
In general, user can be inputted by browser page or keyword is selected to carry out data inquiry request operation.This
A little keywords can often be mapped by object, generate query statement.For example, when browser page shows the order inquiries page,
It is on 01 01st, 2017 that user, which selects initial time, then above-mentioned electronic equipment can generate inquiry language according to the querying condition
Sentence.In practice, above-mentioned electronic equipment can first determine that query context is order table (such as keyword is t_order), then determine
Key word of the inquiry includes lower single time (such as keyword is created), and querying condition is lower single time on 01 01st, 2017
Later (such as created > ' 2017-01-01').It is by taking SQL (Structured Query Language) as an example, inquiry is crucial
Word, querying condition generates query statement can be with are as follows: " select*from t_order where created > ' 2017-01-
01')”。
It is appreciated that in some implementations, key word of the inquiry can be multiple.For example, browser page shows that order is looked into
When asking the page, it is on 01 01st, 2017 that user, which selects initial time, and simultaneous selection restrictive condition is paid successfully.At this point, response
In the data inquiry request operation for detecting elasticity search, above-mentioned electronic equipment can be operated first according to data inquiry request and be detected
The key word of the inquiry of data inquiry request, it is by default grammer that the inquiry is crucial when the key word of the inquiry has multiple
Word splicing.Here predetermined grammer for example can be conjunction " and (and) ", " or (or) ", " non-(not) " etc..Above-mentioned electronics
Equipment can first determine that query context is order table (such as keyword is t_order), then determine that key word of the inquiry includes placing an order
Time (such as keyword is created) and pay status (such as keyword status), querying condition were lower single time in 2017
(such as created > ' 2017-01-01') and pay status are to pay successfully (such as status=1) after 01 day 01 month.With SQL
For (Structured Query Language), by key word of the inquiry, querying condition generates query statement can be with are as follows:
" select*from t_order where created > ' 2017-01-01'and status=1) ".
In the present embodiment, above-mentioned electronic equipment can be previously stored with Object Relation Mapping (Object Relational
Mapping, abbreviation ORM) frame, for the action statement (such as SQL query statement) and Java object of administrative relationships database
Executable object file in java program is mapped in relational database by mapping relations.Above-mentioned electronic equipment can basis
Parameter configuration in data inquiry request is structured query language sentence by Object Relation Mapping frame.Such as in example above-mentioned
In son, implantation tool (sqlMap in such as SQL database) configuration parameter that above-mentioned electronic equipment passes through relational database are as follows:
< select id (selection SQL database)=" get Order By Condition (is ordered by condition acquisition
It is single) ", parameterClass (parameter type)=" java.util.HashMap ", resultClass (result type)="
java.util.HashMap">;
Structured query language sentence after configuration parameter can be such that select*from t_order where
Created>' 2017-01-01'and status=1</select>;
Wherein, in select id, select is the selection grammer of semi-automation ORM frame ibatis ORM frame, and id is
The unique identification (such as database-name t_order) of SQL database, parameterClass are dynamic in SQL query statement
State parameter, resultClass are the return values of SQL query statement, and parameterClass and resultClass are object tag
Fixed attribute.
In some optional implementations of the present embodiment, structured query language sentence includes that retrieval table name and inquiry are closed
Key word, wherein the retrieval table name of structured query language sentence is consistent with elasticity search index name, structured query language language
The key word of the inquiry of sentence is consistent with the key word of the inquiry of elastic search language sentence.It need not when guaranteeing to generate elastic searching request
Conversion retrieval table name and key word of the inquiry, to improve recall precision.
Step 202, according to the mapping relations of structured query language order and executable object file, by structuralized query
Language statement is converted into executable object file.
In the present embodiment, it is (such as shown in FIG. 1 to generate the electronic equipment of the method operation of elastic searching request thereon
Terminal device 101,102) may further according to the mapping relations of structured query language order and executable object file, will
Order and Parameter Switch in structured query language sentence at executable object file (such as Java object) label or attribute.
Specifically, structured query language sentence can be mapped as the execution of executable file by above-mentioned electronic equipment first
Client object, such as sqlMapClient object, in the execution client object, above-mentioned electronic equipment can be looked into structuring
The order in language statement is ask as object tag, such as orders select as select label;Then, pass through executable file
Execution client object, the attribute of the above-mentioned available above-mentioned object tag of electronic equipment, as selecet label id belong to
Property, attribute value can be the mark of the SQL database to be inquired;Then, above-mentioned electronic equipment can be by above-mentioned object tag
The corresponding structured query language sentence of attribute is converted into mapping announcements object (such as MappedStatement object).
In some optional implementations of the present embodiment, above-mentioned electronic equipment can be in detection data inquiry request
Querying condition, wherein querying condition may include key word of the inquiry and condition value.Then, above-mentioned electronic equipment can be by these
Key word of the inquiry and condition value in querying condition respectively as executable object file label and attribute, by the structure
Change query language statement and is converted into executable object file.Optionally, for the querying condition of structured query language sentence, on
Stating electronic equipment can be saved it mapping object in the form of key-value pair (key-value), wherein in the key-value pair
Key (key) can be key word of the inquiry, and value (value) can be the corresponding condition value of key word of the inquiry.For example, for inquiring item
Part " pay status is to pay successfully (such as status=1) ", when being stored in the form of key-value pair, " key " can be key word of the inquiry branch
It pays state (or status etc.), " value " can pay successfully (or numerical value 1 etc.) for condition value.
By the step, above-mentioned electronic equipment can complete acquisition of the executable file to structured query language sentence.
Step 203, the grammer keyword in executable object file is replaced with by elastic search based on default transformation rule
Grammer keyword in grammer.
In the present embodiment, it is (such as shown in FIG. 1 to generate the electronic equipment of the method operation of elastic searching request thereon
102) terminal device 101 can also be previously stored with default transformation rule, further close the grammer in executable object file
Key word replaces with the grammer keyword in elasticity search grammer.
Here, default transformation rule can include but is not limited to the grammer keyword in structured query language and search with elasticity
The corresponding relationship of grammer keyword in Suo Yufa.Wherein grammer keyword may include command keyword (such as select command
Command keyword select), the concatenated key concatenated key and of connection relationship "and" (such as indicate).Such as in SQL
Grammer keyword " select, where, and, or ", respectively correspond elasticity search grammer in grammer keyword " query,
Bool, must, match " etc..
For SQL statement to be converted into JSON (JavaScript Object Notation) string by Java object,
SQL statement can be resolved to java object " QueryAction " by above-mentioned electronic equipment;Recycle the side of " QueryAction "
SQL statement can be converted to the Json string for meeting ES grammer by method.
Step 204, the executable object file after replacement grammer keyword is generated into elastic searching request.
In the present embodiment, it is (such as shown in FIG. 1 to generate the electronic equipment of the method operation of elastic searching request thereon
102) terminal device 101 may further will replace the executable object file after grammer keyword and generate elastic searching request.
For example, above-mentioned electronic equipment can first create ES client object (such as HttpClient), then according to the URL of ES server
(Uniform Resource Locator, uniform resource locator) generates ES request.Wherein, ES request generated can lead to
Cross TCP (Transmission Control Protocol transmission control protocol), HTTP (HyperText Transfer
Protocol, hypertext transfer protocol) etc. transport protocols be sent to ES server.
As an application scenarios, the method for the elastic searching request of the generation of the present embodiment for example can be applied to shopping class
Applications client.The background server for providing support for shopping class applications client can be ES server.The shopping class application
Client can be communicated with ES server by transport protocols such as TCP, HTTP.As shown in Figure 3a, shopping class application visitor
Family end is run in terminal 300, is selected in shopping class applications client homepage, the option of the pull-up Option Box pop-up of label 301
" my order " option is selected, the order inquiries page shown in shopping class applications client switching display Fig. 3 b.Shown in Fig. 3 b
The order inquiries page shows the partial query keyword " whole " of order inquiries, " lower list time " etc..Assuming that user selects
Key word of the inquiry " lower list time ", and single time restriction carries out order inquiries under selection in the drop-down menu 302 provided.Detection
After passing through the inquiry operation that terminal 300 carries out to user, terminal 300 can pass through Object Relation Mapping frame (such as ORM frame first
Frame) parameter in configuration data inquiry request, generate structured query language (such as SQL) sentence;Then, terminal 300 can root
According to the mapping relations of structured query language (such as SQL) order and executable object file (such as Java object), structuring is looked into
It askes language statement and is converted into executable object file (such as Json string);Then, terminal 300 can based on default transformation rule
It executes the grammer keyword in file object and replaces with the grammer keyword that elasticity is searched in grammer;Then, terminal 300 can incite somebody to action
Executable object file after replacing grammer keyword generates ES request, and ES request is sent to ES server and carries out data
Inquiry.After the order information for receiving ES server feedback, terminal device may further be answered by the shopping class run thereon
The page is shown.
The method of the elastic searching request of the generation of the present embodiment, due to passing through executable object file in prior art basis
The upper automatic syntax conversion that carries out generates elastic searching request, so as to improve the validity of elasticity search.
With further reference to Fig. 4, as the realization to the corresponding method for generating elastic searching request of embodiment illustrated in fig. 2,
This application provides a kind of one embodiment of device for generating elastic searching request.
As shown in figure 4, the device 400 of the elastic searching request of the generation of the present embodiment includes: sentence generation module 401, turns
Change the mold block 402, replacement module 403 and request generation module 404.Wherein, sentence generation module 401 may be configured in response to
The data inquiry request operation for detecting elasticity search, passes through the ginseng in Object Relation Mapping frame configuration data inquiry request
Number generates structured query language sentence;Conversion module 402 may be configured to according to structured query language order with can hold
Above structure query language statement is converted into executable object file by the mapping relations of row file object;Replacement module 403
It may be configured to that the grammer keyword in executable object file is replaced with elasticity search grammer according to default transformation rule
In grammer keyword;Request generation module 404 may be configured to that the executable object file after grammer keyword will be replaced
Generate elastic searching request.
In some optional implementations of the present embodiment, above-mentioned conversion module 402 can also include: detection unit (not
Show), it may be configured to the querying condition in detection data inquiry request, wherein above-mentioned querying condition includes that inquiry is crucial
Word and condition value;Converting unit (not shown) may be configured to the key word of the inquiry of above-mentioned querying condition and condition value point
Not as the label of executable object file and attribute, above structure query language statement is converted into executable file pair
As.In some implementations, the key word of the inquiry of above-mentioned querying condition and condition value are transmitted in the form of key-value pair, wherein above-mentioned
Key assignments centering key is key word of the inquiry, is worth for the corresponding condition value of key word of the inquiry.
In some optional implementations of the present embodiment, above-mentioned sentence generation module 401 may further be configured to:
In response to detecting the data inquiry request operation of elasticity search, detection data inquiry request is operated according to data inquiry request
Key word of the inquiry;When above-mentioned key word of the inquiry has multiple, above-mentioned key word of the inquiry is spliced by default grammer.
In some optional implementations of the present embodiment, the structured query language language of the generation of sentence generation module 401
Sentence may include retrieval table name and key word of the inquiry, wherein retrieval table name is consistent with elasticity search index name, above structure
The key word of the inquiry of query language statement is consistent with the key word of the inquiry of elastic search language sentence.
It will be understood by those skilled in the art that the device 400 of above-mentioned generation elasticity searching request further includes some other public affairs
Know structure, such as processor, memory etc., in order to unnecessarily obscure embodiment of the disclosure, these well known structures are in Fig. 4
In be not shown.
Below with reference to Fig. 5, it illustrates the terminal device/server computers for being suitable for being used to realize the embodiment of the present application
The structural schematic diagram of system 500.Terminal device/server shown in Fig. 5 is only an example, should not be to the embodiment of the present application
Function and use scope bring any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in
Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and
Execute various movements appropriate and processing.In RAM503, also it is stored with system 500 and operates required various programs and data.
CPU501, ROM 502 and RAM503 is connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to bus
504。
I/O interface 505 is connected to lower component: the importation including keyboard, touch screen, microphone or scanner etc.
506;Output par, c 507 including cathode-ray tube (CRT), liquid crystal display (LCD) etc.;Storage unit including hard disk etc.
Divide 508;And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via
The network of such as internet executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media
511, such as disk, CD, magneto-optic disk, semiconductor memory etc., are mounted on as needed on driver 510, in order to from
The computer program read thereon is mounted into storage section 508 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed from network by communications portion 509, and/or from detachable media
511 are mounted.When the computer program is executed by central processing unit (CPU) 501, limited in execution the present processes
Above-mentioned function.It should be noted that non-volatile computer-readable medium described herein can be non-volatile computer
Readable signal medium or non-volatile computer readable storage medium storing program for executing either the two any combination.Non-volatile meter
What calculation machine readable storage medium storing program for executing for example may be-but not limited to-electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor is
System, device or device, or any above combination.The more specific example of non-volatile computer readable storage medium storing program for executing can be with
Including but not limited to: there is electrical connection, the portable computer diskette, hard disk, random access storage device of one or more conducting wires
(RAM), read-only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc
Read-only memory (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In this application,
Non-volatile computer readable storage medium storing program for executing can be any tangible medium for including or store program, which can be commanded
Execution system, device or device use or in connection.And in this application, computer-readable signal media can
To include in a base band or as the data-signal that carrier wave a part is propagated, wherein carrying computer-readable program generation
Code.The data-signal of this propagation can take various forms, including but not limited to electromagnetic signal, optical signal or above-mentioned any
Suitable combination.Computer-readable signal media can also be any computer-readable other than computer readable storage medium
Medium, the computer-readable medium can be sent, propagated or transmitted for being used by instruction execution system, device or device
Or program in connection.The program code for including on computer-readable medium can pass with any suitable medium
It is defeated, including but not limited to: wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use
The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
Being described in module involved in the embodiment of the present application can be realized by way of software, can also be by hard
The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet
Include sentence generation module, conversion module, replacement module and request generation module.Wherein, the title of these modules is in certain situation
Under do not constitute restriction to the unit itself, for example, sentence generation module is also described as " being configured in response to inspection
The data inquiry request operation for measuring elasticity search, by the parameter in Object Relation Mapping frame configuration data inquiry request,
Generate the module of structured query language sentence ".
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art
Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature
Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed herein
Can technical characteristic replaced mutually and the technical solution that is formed.
Claims (12)
1. a kind of method for generating elastic searching request, which is characterized in that the described method includes:
In response to detecting the data inquiry request operation of elasticity search, asked by the inquiry of Object Relation Mapping frame configuration data
Parameter in asking generates structured query language sentence;
According to the mapping relations of structured query language order and executable object file, by the structured query language sentence
It is converted into executable object file;
The grammer keyword in executable object file is replaced with into the grammer that elasticity is searched in grammer according to default transformation rule
Keyword;
Executable object file after replacement grammer keyword is generated into elastic searching request.
2. the method according to claim 1, wherein described according to structured query language order and executable text
The mapping relations of part object, the structured query language sentence, which is converted into executable object file, includes:
Querying condition in detection data inquiry request, wherein the querying condition includes key word of the inquiry and condition value;
It, will using the key word of the inquiry of the querying condition and condition value as the label of executable object file and attribute
The structured query language sentence is converted into executable object file.
3. according to the method described in claim 2, it is characterized in that, the key word of the inquiry and condition value of the querying condition are with key
The form transmitting of value pair, wherein the key assignments centering key is key word of the inquiry, is worth for the corresponding condition value of key word of the inquiry.
4. the method according to claim 1, wherein the data query in response to detecting elasticity search is asked
Operation is asked, by the parameter in Object Relation Mapping frame configuration data inquiry request, generates structured query language sentence packet
It includes:
In response to detecting the data inquiry request operation of elasticity search, detection data inquiry is operated according to data inquiry request and is asked
The key word of the inquiry asked;
When the key word of the inquiry has multiple, the key word of the inquiry is spliced by default grammer, generates structuralized query
Language statement.
5. the method according to claim 1, wherein the structured query language sentence include retrieval table name and
Key word of the inquiry, wherein the retrieval table name of the structured query language sentence is consistent with elasticity search index name, the knot
The key word of the inquiry of structure query language statement is consistent with the key word of the inquiry of elastic search language sentence.
6. a kind of device for generating elastic searching request, which is characterized in that described device includes:
Sentence generation module is configured to pass through object relationship in response to detecting the data inquiry request operation of elasticity search
Parameter in mapping framework configuration data inquiry request generates structured query language sentence;
Conversion module is configured to the mapping relations according to structured query language order and executable object file, will be described
Structured query language sentence is converted into executable object file;
Replacement module is configured to that the grammer keyword in executable object file is replaced with elasticity according to default transformation rule
Search for the grammer keyword in grammer;
Generation module is requested, is configured to that the elastic searching request of executable object file generation after grammer keyword will be replaced.
7. device according to claim 6, which is characterized in that the conversion module includes:
Detection unit, the querying condition being configured in detection data inquiry request, wherein the querying condition includes that inquiry is closed
Key word and condition value;
Converting unit is configured to using the key word of the inquiry of the querying condition and condition value as executable object file
Label and attribute, the structured query language sentence is converted into executable object file.
8. device according to claim 7, which is characterized in that the key word of the inquiry and condition value of the querying condition are with key
The form transmitting of value pair, wherein the key assignments centering key is key word of the inquiry, is worth for the corresponding condition value of key word of the inquiry.
9. device according to claim 6, which is characterized in that the sentence generation module is further configured to:
In response to detecting the data inquiry request operation of elasticity search, detection data inquiry is operated according to data inquiry request and is asked
The key word of the inquiry asked;
When the key word of the inquiry has multiple, the key word of the inquiry is spliced by default grammer.
10. device according to claim 6, which is characterized in that the structured query language sentence includes retrieval table name
And key word of the inquiry, wherein the retrieval table name of the structured query language sentence is consistent with elasticity search index name, described
The key word of the inquiry of structured query language sentence is consistent with the key word of the inquiry of elastic search language sentence.
11. a kind of calculating equipment, comprising:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processors are real
Now such as method as claimed in any one of claims 1 to 5.
12. a kind of non-volatile computer readable storage medium storing program for executing, is stored thereon with computer program, which is characterized in that the program
Such as method as claimed in any one of claims 1 to 5 is realized when being executed by processor.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710451970.7A CN109145014A (en) | 2017-06-15 | 2017-06-15 | The method and apparatus for generating elastic searching request |
PCT/CN2018/082283 WO2018228034A1 (en) | 2017-06-15 | 2018-04-09 | Method and device for generating elastic search request |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710451970.7A CN109145014A (en) | 2017-06-15 | 2017-06-15 | The method and apparatus for generating elastic searching request |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109145014A true CN109145014A (en) | 2019-01-04 |
Family
ID=64659423
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710451970.7A Pending CN109145014A (en) | 2017-06-15 | 2017-06-15 | The method and apparatus for generating elastic searching request |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109145014A (en) |
WO (1) | WO2018228034A1 (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110888876A (en) * | 2019-10-31 | 2020-03-17 | 平安科技(深圳)有限公司 | Method and device for generating database script, storage medium and computer equipment |
CN111026931A (en) * | 2019-12-09 | 2020-04-17 | 中国建设银行股份有限公司 | Data query method, device, equipment and medium |
CN111460241A (en) * | 2020-04-26 | 2020-07-28 | 甬矽电子(宁波)股份有限公司 | Data query method and device, electronic equipment and storage medium |
CN111522840A (en) * | 2020-04-27 | 2020-08-11 | 平安科技(深圳)有限公司 | Label configuration method, device, equipment and computer readable storage medium |
CN112765200A (en) * | 2021-01-18 | 2021-05-07 | 武汉悦学帮网络技术有限公司 | Data query method and device based on Elasticissearch |
CN113111356A (en) * | 2021-03-09 | 2021-07-13 | 深圳市教育信息技术中心(深圳市教育装备中心) | Data encryption method, device, equipment and medium |
CN114168565A (en) * | 2021-12-10 | 2022-03-11 | 北京宇信科技集团股份有限公司 | Backtracking test method, device and system of business rule model and decision engine |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112988132B (en) * | 2021-02-25 | 2021-12-21 | 平安科技(深圳)有限公司 | Automatic generation method and device of data interface, computer equipment and storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102004634A (en) * | 2009-09-01 | 2011-04-06 | 上海杉达学院 | Hierarchical business management system |
CN102932474A (en) * | 2012-11-14 | 2013-02-13 | 北京星网锐捷网络技术有限公司 | Method, device and system for analyzing message |
CN103399887A (en) * | 2013-07-19 | 2013-11-20 | 蓝盾信息安全技术股份有限公司 | Query and statistical analysis system for mass logs |
CN104317964A (en) * | 2014-11-14 | 2015-01-28 | 中国建设银行股份有限公司 | Object-relational mapping method and system based on iBatis |
CN104881490A (en) * | 2015-06-10 | 2015-09-02 | 中科宇图天下科技有限公司 | WEB form data access method and system |
CN105224633A (en) * | 2015-09-24 | 2016-01-06 | 北京锐安科技有限公司 | Based on solr querying method and the device of sql like language |
CN106528797A (en) * | 2016-11-10 | 2017-03-22 | 上海轻维软件有限公司 | DSL query method based on Elasticsearch |
CN106649630A (en) * | 2016-12-07 | 2017-05-10 | 乐视控股(北京)有限公司 | Data query method and device |
-
2017
- 2017-06-15 CN CN201710451970.7A patent/CN109145014A/en active Pending
-
2018
- 2018-04-09 WO PCT/CN2018/082283 patent/WO2018228034A1/en active Application Filing
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102004634A (en) * | 2009-09-01 | 2011-04-06 | 上海杉达学院 | Hierarchical business management system |
CN102932474A (en) * | 2012-11-14 | 2013-02-13 | 北京星网锐捷网络技术有限公司 | Method, device and system for analyzing message |
CN103399887A (en) * | 2013-07-19 | 2013-11-20 | 蓝盾信息安全技术股份有限公司 | Query and statistical analysis system for mass logs |
CN104317964A (en) * | 2014-11-14 | 2015-01-28 | 中国建设银行股份有限公司 | Object-relational mapping method and system based on iBatis |
CN104881490A (en) * | 2015-06-10 | 2015-09-02 | 中科宇图天下科技有限公司 | WEB form data access method and system |
CN105224633A (en) * | 2015-09-24 | 2016-01-06 | 北京锐安科技有限公司 | Based on solr querying method and the device of sql like language |
CN106528797A (en) * | 2016-11-10 | 2017-03-22 | 上海轻维软件有限公司 | DSL query method based on Elasticsearch |
CN106649630A (en) * | 2016-12-07 | 2017-05-10 | 乐视控股(北京)有限公司 | Data query method and device |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110888876A (en) * | 2019-10-31 | 2020-03-17 | 平安科技(深圳)有限公司 | Method and device for generating database script, storage medium and computer equipment |
CN111026931A (en) * | 2019-12-09 | 2020-04-17 | 中国建设银行股份有限公司 | Data query method, device, equipment and medium |
CN111460241A (en) * | 2020-04-26 | 2020-07-28 | 甬矽电子(宁波)股份有限公司 | Data query method and device, electronic equipment and storage medium |
CN111460241B (en) * | 2020-04-26 | 2024-01-23 | 甬矽电子(宁波)股份有限公司 | Data query method and device, electronic equipment and storage medium |
CN111522840A (en) * | 2020-04-27 | 2020-08-11 | 平安科技(深圳)有限公司 | Label configuration method, device, equipment and computer readable storage medium |
CN111522840B (en) * | 2020-04-27 | 2023-08-11 | 平安科技(深圳)有限公司 | Label configuration method, device, equipment and computer readable storage medium |
CN112765200A (en) * | 2021-01-18 | 2021-05-07 | 武汉悦学帮网络技术有限公司 | Data query method and device based on Elasticissearch |
CN113111356A (en) * | 2021-03-09 | 2021-07-13 | 深圳市教育信息技术中心(深圳市教育装备中心) | Data encryption method, device, equipment and medium |
CN114168565A (en) * | 2021-12-10 | 2022-03-11 | 北京宇信科技集团股份有限公司 | Backtracking test method, device and system of business rule model and decision engine |
Also Published As
Publication number | Publication date |
---|---|
WO2018228034A1 (en) | 2018-12-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109145014A (en) | The method and apparatus for generating elastic searching request | |
US10942708B2 (en) | Generating web API specification from online documentation | |
CN109062563B (en) | Method and device for generating page | |
CN108229704B (en) | Method and device for pushing information | |
US9098314B2 (en) | Systems and methods for web based application modeling and generation | |
CN107491534A (en) | Information processing method and device | |
CN108628830B (en) | Semantic recognition method and device | |
CN109683998A (en) | Internationalize implementation method, device and system | |
CN109271403A (en) | A kind of operating method of data query, device, medium and electronic equipment | |
US9098583B2 (en) | Semantic analysis driven service creation within a multi-level business process | |
CN109036425A (en) | Method and apparatus for operating intelligent terminal | |
CN108804327A (en) | A kind of method and apparatus of automatic Data Generation Test | |
CN109254917B (en) | Method and apparatus for test data flow system | |
CN110321544B (en) | Method and device for generating information | |
CN109684188A (en) | Test method and device | |
CN109241722A (en) | For obtaining method, electronic equipment and the computer-readable medium of information | |
CN109840192A (en) | The method and apparatus of automatic test | |
US9208194B2 (en) | Expanding high level queries | |
CN110059172B (en) | Method and device for recommending answers based on natural language understanding | |
CN108694120A (en) | The method and apparatus of testing service component | |
CN111488386B (en) | Data query method and device | |
US20190138646A1 (en) | Systematic Browsing of Automated Conversation Exchange Program Knowledge Bases | |
CN111787041B (en) | Method and device for processing data | |
CN108491387A (en) | Method and apparatus for output information | |
CN108959294A (en) | A kind of method and apparatus accessing search engine |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |