CN109325047A - A kind of interactive mode ElasticSearch depth paging query method and apparatus - Google Patents

A kind of interactive mode ElasticSearch depth paging query method and apparatus Download PDF

Info

Publication number
CN109325047A
CN109325047A CN201811395531.XA CN201811395531A CN109325047A CN 109325047 A CN109325047 A CN 109325047A CN 201811395531 A CN201811395531 A CN 201811395531A CN 109325047 A CN109325047 A CN 109325047A
Authority
CN
China
Prior art keywords
field
inquiry
elasticsearch
user
paging
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.)
Granted
Application number
CN201811395531.XA
Other languages
Chinese (zh)
Other versions
CN109325047B (en
Inventor
董晓斌
喻波
王志海
安鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Wondersoft Technology Co Ltd
Original Assignee
Beijing Wondersoft Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Wondersoft Technology Co Ltd filed Critical Beijing Wondersoft Technology Co Ltd
Priority to CN201811395531.XA priority Critical patent/CN109325047B/en
Publication of CN109325047A publication Critical patent/CN109325047A/en
Application granted granted Critical
Publication of CN109325047B publication Critical patent/CN109325047B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The present invention provides a kind of methods of interactive mode ElasticSearch depth paging query, characterized by comprising: receives the inquiry request that client is sent;Judge the inquiry request whether be for the first time inquiry request and be less than the paging threshold value, if being no, then interact formula inquiry mode, by polymerization calculate inquiry field other than can exhaustive classification field data, and according to user select refinement field combination querying condition be sent to ElasticSearch server;It encapsulates the result data returned by ElasticSearch server and returns to client.The present invention dynamic recommendation query condition can interact in real time with user using interactive inquiry mechanism by can dynamically recommend in real time, provide the user with selection, so that inquiry is more friendly and efficient.

Description

A kind of interactive mode ElasticSearch depth paging query method and apparatus
Technical field
The present invention relates to data processing fields, and in particular to a kind of interactive mode ElasticSearch depth paging query Method and electronic equipment.
Background technique
Inquiry is most commonly seen one of the operation of search server.Wherein, ElasticSearch is one based on Lucene Search server.It provides the full-text search engine of a distributed multi-user ability.Elasticsearch is to use Java Exploitation, and as the open source code publication under Apache license terms, it is Enterprise search engine currently popular; ElasticSearch is Oriented Documents (document oriented), it means that it can store entire object or document (document).However it is not only to store, the content that can also index (index) each document makes it possible to be searched.? In ElasticSearch, you can be indexed document (rather than the data embarked on journey in column), search for, sort, filtering.
But ElasticSearch is as high performance memory database, in a distributed system due to it, sort result Cost and spend with paging deeply (depth paging) and be doubled and redoubled, therefore, how according to previous query result meter Further inquiry operation, especially depth paging query are analysed in point counting, are the technologies that ElaticSeach database most merits attention Problem.
Summary of the invention
In view of the above technical problems, when carrying out specific aim calculating especially for the result of data base querying, lack corresponding Inquiry mechanism, therefore, the present invention increases interactive operation on the basis of original inquiry to form interactive inquiry, passes through friendship Mutual formula inquiry can preferably help user to obtain the most desirable information from database by accurate complete search condition.Tool Body, the present invention by again according to query result, polymerization calculate analysis recommend user can be according to non-querying condition other than Can exhaustive classification field, polymerize all types of the field are polymerize and are converted to user it is intelligible description return to The page, user select the classification for needing to refine, and query composition condition is sent to Web server and carries out data query, utilize increase Query refinement condition, further refined queries, which reduce matching number of documents, to be reduced, to efficiently solve in ElasticSearch In depth paging query the problem of cost prohibitive.
To achieve the above object, the invention proposes the methods based on interactive ElasticSearch depth paging query And electronic equipment.Specifically, using following technical scheme:
In a first aspect, the present invention provides a kind of methods of interactive mode ElasticSearch depth paging query, including under State step:
Step 1: receiving the inquiry request that client is sent;
Step 2: judging whether the inquiry request is inquiry request for the first time, if it is goes to step 4, otherwise goes to step 3;
Step 3: the paging parameter of the inquiry request and the relationship of paging threshold value are judged, if it is less than the paging threshold Value, then go to step 4, otherwise go to step 5;
Step 4: sending the inquiry request to ElasticSearch, go to step 6;
Step 5: polymerization calculate inquiry field other than can exhaustive classification field data, and according to user selection it is thin Change field combination querying condition and is sent to ElasticSearch server;
Step 6: the result data that encapsulation is returned by ElasticSearch server;
Step 7: the result data is returned into client.
In the technology of above-mentioned technical proposal, further, the step 5 further includes following step:
Step 5.1: polymerization calculates the data of the field other than inquiry field;
Step 5.2: prompting the user whether to need refined queries;
Step 5.3: when user needs refined queries, the refinement field for polymerizeing calculated result push being shown to client;
Step 5.4: the corresponding refinement field of user's selection;
Step 5.5: the corresponding all specific classifications of field being returned to according to the refinement field, carrying out polymerization should The all types of field, which polymerize and are converted to the intelligible description of user, returns to the page;
Step 5.6: user selects corresponding classification;
Step 5.7: the classification for needing to refine is selected according to user, query composition condition is sent to ElasticSearch clothes Business device.
In the technology of above-mentioned technical proposal, further, the field other than the inquiry field is can exhaustive classification Field.
In the technology of above-mentioned technical proposal, further, the polymerization calculating in the step 5.1 further includes following steps It is rapid:
Step 5.1.1: the relationship of the field other than the analysis inquiry field;
Step 5.1.2: the data of the field with incidence relation are polymerize.
In the technology of above-mentioned technical proposal, further, the client is browser.
In the technology of above-mentioned technical proposal, further, the client is the client with graphic interface.
In the technology of above-mentioned technical proposal, further, the paging parameter calculates as follows:
Position+inquiry document item number of paging parameter=inquiry starting point document.
In the technology of above-mentioned technical proposal, further, the paging threshold value is 10000.
On the other hand, the present invention also provides a kind of electronic equipment of interactive mode ElasticSearch depth paging query, Include:
Processor and memory, the memory have the medium for being stored with program code, when the processor reads institute When stating the program code of media storage, the electronic equipment is able to carry out the above method.
Compared with prior art, the technical solution of embodiment of the present invention at least has technology effect beneficial below Fruit:
(1) optimize Elasticsearch depth paging query problem, weaken depth paging bottleneck, Optimizing Queries from And it solves ElasticSearch and is combined by from size to carry out paging query.It is dynamically provided by interactive prompt The screening conditions of refinement are selected for user, within the maximum range that query result is maintained to setting as far as possible, are avoided The problem of reporting an error due to being more than the maximum value of setting because inquiring, optimization system function, Optimizing Queries.
(2) interactive inquiry mechanism has been used, under premised on basic querying condition inquires obtained query result, Analysis is calculated further according to the polymerization that can carry out with the field of exhaustive classification other than non-basic querying condition, and by the word of polymerization analysis The all types of section polymerize and are converted to the intelligible description of user, are translated into classification list, then to return to page The mode in face flexibly dynamically recommends user in real time, the classification that the result selection that user recommends according to analysis needs to refine, group It closes querying condition and is sent to Web server progress data query.
(3) increase query refinement condition, reduce inquiry pressure, the matching number of documents that further refined queries reduces is reduced will Query result maintains in the maximum range of setting.
While the present invention improves whole performance, user's more dynamic is allow in the case where data volume is bigger Total data required for user query is flexibly guided in an interactive way.According to other than basic querying condition can be poor The field for lifting classification carrys out accurate query information.Depth paging bring bottleneck is not only weakened, but also makes inquiry more friendly With it is efficient.
Detailed description of the invention
Fig. 1 is one of interactive mode ElasticSearch depth paging query method proposed by the present invention more preferably embodiment party The structure and flow diagram of formula;
Fig. 2 is a concrete application field of interactive mode ElasticSearch depth paging query method proposed by the present invention The schematic diagram of scape;
Fig. 3 be one of the electronic equipment of interactive mode ElasticSearch depth paging query proposed by the present invention more preferably The structure of embodiment.
The present invention is described in more detail below.But following examples is only simple example of the invention, not generation Table or limitation the scope of the present invention, protection scope of the present invention are subject to claims.
Specific embodiment
To further illustrate the technical scheme of the present invention below with reference to the accompanying drawings and specific embodiments.
In order to better illustrate the present invention, it is easy to understand technical solution of the present invention, of the invention is typical but non-limiting Embodiment is as follows, it is necessary to be noted that embodiment listed by description of the invention is merely to the side of describing the problem Just the illustrative embodiment provided must not be not understood as unique correct embodiment of the invention, must not more be interpreted as It is limiting the scope of the invention explanation.
It is that one of the interactive ElasticSearch depth paging query method of proposition of the invention is preferable referring to Fig. 1 Embodiment, the method are based on ElasticSearch search server.When carrying out paging query comprising following steps:
S101, the inquiry request that client is sent is received;
S102, judge whether above-mentioned inquiry request is to send inquiry request for the first time, if so, turning S104;If it is not, judgement Whether paging parameter is less than paging threshold value, and the paging threshold value can be 10000, and the paging parameter passes through zequin value from It is obtained with the sum of scale size, wherein which row the from indicates that since, the size indicates how many documents of inquiry; If it is less than the threshold value, then turn S104;If it is greater than the threshold value, then turn S105;
S104: inquiry request is sent to ElasticSearch, turns S112;
S105: polymerization calculate inquiry field other than can exhaustive classification field data;
S106: it prompts the user whether to need refined queries;
S107: when user needs refined queries, being shown to client for the refinement field for polymerizeing calculated result push, described Client can be browser or any client with graphic interface,;
S108: the corresponding refinement field of user's selection;
S109: the corresponding all specific classifications of field are returned to according to the refinement field, are polymerize the word The all types of section, which polymerize and are converted to the intelligible description of user, returns to the page;
S110: user selects corresponding classification;
S111: selecting the classification for needing to refine according to user, and query composition condition is sent to ElasticSearch service Device;
S112: the result data that encapsulation is returned by ElasticSearch server;
S113: returning to client for the result data, the client can for browser or it is any have it is graphical The client at interface.
Wherein, step S105-S111 realizes the interactive inquiry mechanism of user and ElasticSearch, can move in real time Recommendation query condition and the user of state interact, and user is allowed to provide selection, so that inquiry is more friendly and efficient.Together When, it is selected by polymerizeing the refined queries condition calculated in addition to basic querying condition for user, allows user neatly Effective data accurately are obtained in mass data according to recommendation.Depth paging bring bottleneck is not only weakened, but also So that the information that user obtains is more accurate, a large amount of time cost and human cost have been saved.
As a more preferably embodiment, the polymerization calculating in step S105 further includes following step:
(1) relationship of the field other than the inquiry field is analyzed;
(2) data of the field with incidence relation are polymerize.
In order to make it easy to understand, being illustrated below with a simplified example, such as " age " and " date of birth " word in database Section, the two fields belong to can exhaustive classification field, and the data content of the two fields have mathematical operation relationship (that is: can calculate the age by the date of birth, vice versa), then they belong to incidence relation, then by the data of the two fields It carries out aggregating into a field, then can reduce the refinement field for being pushed to user's selection.It effectively reduces user and selects refinement word The complexity of section.For another example certain unit, the type of work post is related to gender (certain work posts are suitable only for male employee), then they are also deposited In certain incidence relation, the means that polymerization can also be taken to calculate are to reduce the complexity that user refines selection.It has to be noted that Above-mentioned simplified example should not be used as the limitation of protection scope just for the sake of helping to understand technical solution of the present invention.This field Technical staff can be generalized to more specific embodiments, these embodiment party it is understood that by the description of present embodiment Formula all should belong to protection scope of the present invention.
It referring to fig. 2, is the implement scene of a concrete application of the invention, wherein (browser any has client The client of graphic interface) external inquiry request is sent to Web server, it is responsible for providing by ElasticSearch corresponding Data are inquired to Web server, and client is obtained and looked into from ElasticSearch by interactive inquiry with Web server See more data.In addition, client is also responsible for user's display data, especially displaying exhaustive classification field and refined queries is arranged Classification required for table is selected for user;The relationship of paging parameter Yu paging threshold value, exhaustive classification are judged by Web server Field, Aggregation field type simultaneously convert them to the intelligible description form of user, and ask to ElasticSearch transmission It asks, to inquire data.
As the second aspect of the invention, also offer a kind of electronic equipment, referring to Fig. 3, comprising: processor 1120 and deposit Reservoir 1140, the memory 1140 has the medium (computer readable storage medium) for being stored with program code, when the place When reason device reads the program code of the media storage, by the assistance of input unit 1130 and output unit 1150, so that institute It states electronic equipment and is able to carry out above method step.
For method implement, various embodiments proposed by the present invention can with use such as computer software, hardware or The computer-readable medium of any combination thereof is implemented.Hardware is implemented, various embodiments proposed by the present invention can lead to It crosses using application-specific IC (ASIC), digital signal processor (DSP), digital signal processing device (DSPD), can compile Journey logic device (PLD), processor, processor, microprocessor, microprocessor, is designed field programmable gate array (FPGA) Implement to execute at least one of electronic unit of function described herein, it is in some cases, proposed by the present invention each Kind embodiment can be implemented in processor 1120 shown in figure.For software implementation, various embodiment party proposed by the present invention Formula can be implemented with the individual software module that allows to execute at least one functions or operations.Software code can be by with any Software application (or program) that programming language appropriate is write is implemented, and software code can store in memory 1140 And it is executed by processor 1120.
The Applicant declares that the present invention illustrates detailed construction feature of the invention, but the present invention by above embodiment It is not limited to above-mentioned detailed construction feature, that is, does not mean that the present invention must rely on above-mentioned detailed construction feature and could implement. It should be clear to those skilled in the art, any improvement in the present invention, replaces to the equivalent of component selected by the present invention It changes and the increase of accessory, the selection of concrete mode etc., all of which fall within the scope of protection and disclosure of the present invention.
The preferred embodiment of the present invention has been described above in detail, still, during present invention is not limited to the embodiments described above Detail within the scope of the technical concept of the present invention can be with various simple variants of the technical solution of the present invention are made, this A little simple variants all belong to the scope of protection of the present invention.
It is further to note that specific technical features described in the above specific embodiments, in not lance In the case where shield, can be combined in any appropriate way, in order to avoid unnecessary repetition, the present invention to it is various can No further explanation will be given for the combination of energy.
In addition, various embodiments of the present invention can be combined randomly, as long as it is without prejudice to originally The thought of invention, it should also be regarded as the disclosure of the present invention.

Claims (9)

1. a kind of method of interactive mode ElasticSearch depth paging query, it is characterised in that include the following steps:
Step 1: receiving the inquiry request that client is sent;
Step 2: judging whether the inquiry request is inquiry request for the first time, if it is goes to step 4, otherwise goes to step 3;
Step 3: judging the paging parameter of the inquiry request and the relationship of paging threshold value, if it is less than the paging threshold value, then 4 are gone to step, otherwise goes to step 5;
Step 4: sending the inquiry request to ElasticSearch, go to step 6;
Step 5: polymerization calculate inquiry field other than can exhaustive classification field data, and according to user select refinement word Section query composition condition is sent to ElasticSearch server;
Step 6: the result data that encapsulation is returned by ElasticSearch server;
Step 7: the result data is returned into client.
2. the method as described in claim 1, it is characterised in that the step 5 further includes following step:
Step 5.1: polymerization calculates the data of the field other than inquiry field;
Step 5.2: prompting the user whether to need refined queries;
Step 5.3: when user needs refined queries, the refinement field for polymerizeing calculated result push being shown to client;
Step 5.4: the corresponding refinement field of user's selection;
Step 5.5: the corresponding all specific classifications of field being returned to according to the refinement field, are polymerize the field All types polymerize and be converted to user it is intelligible description return to the page;
Step 5.6: user selects corresponding classification;
Step 5.7: the classification for needing to refine is selected according to user, query composition condition is sent to ElasticSearch server.
3. method as claimed in claim 3, it is characterised in that it is described inquiry field other than field be can exhaustive classification word Section.
4. method as claimed in claim 3, it is characterised in that the polymerization calculating in the step 5.1 further includes following step:
Step 5.1.1: the relationship of the field other than the analysis inquiry field;
Step 5.1.2: the data of the field with incidence relation are polymerize.
5. method as claimed in claim 4, it is characterised in that the client is browser.
6. method as claimed in claim 4, it is characterised in that the client is the client with graphic interface.
7. such as method described in claim 5 or 6, it is characterised in that the paging parameter calculates as follows:
Position+inquiry document item number of paging parameter=inquiry starting point document.
8. method as claimed in claim 5, it is characterised in that the paging threshold value is 10000.
9. a kind of electronic equipment of interactive mode ElasticSearch depth paging query, characterized by comprising:
Processor and memory, the memory have the medium for being stored with program code, when processor reading is given an account of When the program code of matter storage, the electronic equipment is able to carry out the described in any item methods of claim 1-8.
CN201811395531.XA 2018-11-22 2018-11-22 Interactive elastic search deep paging query method and device Active CN109325047B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811395531.XA CN109325047B (en) 2018-11-22 2018-11-22 Interactive elastic search deep paging query method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811395531.XA CN109325047B (en) 2018-11-22 2018-11-22 Interactive elastic search deep paging query method and device

Publications (2)

Publication Number Publication Date
CN109325047A true CN109325047A (en) 2019-02-12
CN109325047B CN109325047B (en) 2021-04-16

Family

ID=65258169

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811395531.XA Active CN109325047B (en) 2018-11-22 2018-11-22 Interactive elastic search deep paging query method and device

Country Status (1)

Country Link
CN (1) CN109325047B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110083627A (en) * 2019-04-28 2019-08-02 江苏满运软件科技有限公司 Data processing method, system, computer equipment and storage medium
CN110232044A (en) * 2019-06-17 2019-09-13 山东浪潮通软信息科技有限公司 A kind of realization system and method for big data aggregates dispatch service
CN111680063A (en) * 2020-05-25 2020-09-18 泰康保险集团股份有限公司 Method and device for querying data in Elasticissearch paging mode
CN112364280A (en) * 2020-10-27 2021-02-12 深圳开源互联网安全技术有限公司 Dynamic adaptation method, system, device and storage medium for paging query

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101842787A (en) * 2007-09-14 2010-09-22 谷歌公司 Suggesting alterntive queries in query results
CN102419778A (en) * 2012-01-09 2012-04-18 中国科学院软件研究所 Information searching method for mining and clustering sub-topics of query sentences
CN102591985A (en) * 2011-01-11 2012-07-18 微软公司 Query reformulation in association with a search box
US20150154315A1 (en) * 2004-05-07 2015-06-04 Ebay Inc. Method and system to facilitate a search of an information resource
CN106528797A (en) * 2016-11-10 2017-03-22 上海轻维软件有限公司 DSL query method based on Elasticsearch
CN108509524A (en) * 2018-03-12 2018-09-07 上海哔哩哔哩科技有限公司 Method, server and the system of data processing of data processing

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150154315A1 (en) * 2004-05-07 2015-06-04 Ebay Inc. Method and system to facilitate a search of an information resource
CN101842787A (en) * 2007-09-14 2010-09-22 谷歌公司 Suggesting alterntive queries in query results
CN102591985A (en) * 2011-01-11 2012-07-18 微软公司 Query reformulation in association with a search box
CN102419778A (en) * 2012-01-09 2012-04-18 中国科学院软件研究所 Information searching method for mining and clustering sub-topics of query sentences
CN106528797A (en) * 2016-11-10 2017-03-22 上海轻维软件有限公司 DSL query method based on Elasticsearch
CN108509524A (en) * 2018-03-12 2018-09-07 上海哔哩哔哩科技有限公司 Method, server and the system of data processing of data processing

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110083627A (en) * 2019-04-28 2019-08-02 江苏满运软件科技有限公司 Data processing method, system, computer equipment and storage medium
CN110232044A (en) * 2019-06-17 2019-09-13 山东浪潮通软信息科技有限公司 A kind of realization system and method for big data aggregates dispatch service
CN110232044B (en) * 2019-06-17 2023-03-28 浪潮通用软件有限公司 System and method for realizing big data summarizing and scheduling service
CN111680063A (en) * 2020-05-25 2020-09-18 泰康保险集团股份有限公司 Method and device for querying data in Elasticissearch paging mode
CN111680063B (en) * 2020-05-25 2023-08-18 泰康保险集团股份有限公司 Method and device for paging query data by elastic search
CN112364280A (en) * 2020-10-27 2021-02-12 深圳开源互联网安全技术有限公司 Dynamic adaptation method, system, device and storage medium for paging query

Also Published As

Publication number Publication date
CN109325047B (en) 2021-04-16

Similar Documents

Publication Publication Date Title
CN109325047A (en) A kind of interactive mode ElasticSearch depth paging query method and apparatus
US6594654B1 (en) Systems and methods for continuously accumulating research information via a computer network
Sheng et al. Optimal algorithms for crawling a hidden database in the web
CN114625732B (en) Query method and system based on structured query language SQL
CN103123649B (en) A kind of message searching method based on microblog and system
CN112257419B (en) Intelligent retrieval method and device for calculating patent document similarity based on word frequency and semantics, electronic equipment and storage medium thereof
CN110069610A (en) Search method, device, equipment and storage medium based on Solr
CN103377232A (en) Headline keyword recommendation method and system
CN1755682A (en) System and method for ranking search results using link distance
CN101853449A (en) Legal question intelligent diagnosis method and system
CN104321802A (en) Image analysis device, image analysis system, and image analysis method
CN105389352A (en) Log processing method and apparatus
US20190114711A1 (en) Financial analysis system and method for unstructured text data
CN104933100A (en) Keyword recommendation method and device
CN108875065B (en) Indonesia news webpage recommendation method based on content
CN105354256A (en) Data pagination query method and apparatus
CN102200974A (en) Unified information retrieval intelligent agent system and method for search engine
CN105183803A (en) Personalized search method and search apparatus thereof in social network platform
US8700624B1 (en) Collaborative search apps platform for web search
CN103116635A (en) Field-oriented method and system for collecting invisible web resources
US7458001B2 (en) Sequential pattern extracting apparatus
CN103678513A (en) Interactive search generation method and system
CN113360517A (en) Data processing method and device, electronic equipment and storage medium
CN104462556A (en) Method and device for recommending question and answer page related questions
CN103678601A (en) Model essay retrieval request processing method and device

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
GR01 Patent grant
GR01 Patent grant