Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case Analysis of Class Google Advanced Retrieval implemented by Elasticsearch

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about the case analysis of Elasticsearch implementation class Google advanced retrieval, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

1. Function points of advanced retrieval

Through the advanced search configuration search items, we can filter out the irrelevant information more accurately and get the most desired retrieval information.

Take Google search as an example (intercept core fragments):

Second, advanced search split 1, including all the following keywords:

Need word segmentation processing

If you need to specify a field, use matchQuery to implement

If you do not need to specify the full-text search of the field, use queryStringQuery to implement

2. Contains the following complete keywords:

Complete matching characters are required, which can be implemented using wildcardQuery combined with "*".

3. Include any of the following keywords:

Spaces separate each keyword. You need to split multiple word spaces, and then implement each keyword through should combined with wildcardQuery traversal.

4. The following keywords are not included:

Contains the negative side of all the following keywords

If you need to specify fields, use must_not combined with matchQuery to implement

If you do not need to specify fields, use must_not combined with queryStringQuery to implement

5. The time limit for searching web pages is:

Limit the start and end time of the search, which is achieved through rangeQuery.

6. Keyword location:

Different implementations are adopted according to the location of keywords.

Keywords in the title field: specify title for retrieval

Keywords in the content field: specify content for retrieval

Keywords are located in all fields: do not specify fields for retrieval, but mostly use queryStringQuery.

Third, the implementation of DSL advanced retrieval.

POST detail_index/_search

{

"from": 0

"size": 10

"query": {

"bool": {

"must": [

{

"match": {

"title": {

"query": "Apple Jobs"

"operator": "OR"

"prefix_length": 0

"max_expansions": 50

"fuzzy_transpositions": true

"lenient": false

"zero_terms_query": "NONE"

"boost": 1.0

}

}

}

{

"wildcard": {

"title.keyword": {

"wildcard": "* Apple President Cook *"

"boost": 1.0

}

}

}

{

"range": {

"create_time": {

"from": "2017-09-07 00:00:00"

"to": "2017-09-15 23:59:59"

"include_lower": true

"include_upper": true

"boost": 1.0

}

}

}

]

"must_not": [

{

"wildcard": {

"title.keyword": {

"wildcard": "* Apple pear *"

"boost": 1.0

}

}

}

]

"should": [

{

"wildcard": {

"title.keyword": {

"wildcard": "* iPhone *"

"boost": 1.0

}

}

}

{

"wildcard": {

"title.keyword": {

"wildcard": "* iphoneX*"

"boost": 1.0

}

}

}

]

"disable_coord": false

"adjust_pure_negative": true

"boost": 1.0

}

}

"_ source": {

"includes": [

"title"

"content"

]

"excludes": []

}

"highlight": {

"pre_tags": [

"

]

"post_tags": [

"

]

"fragment_size":

"number_of_fragments": 5

"require_field_match": true

"fields": {

"title": {}

}

}

}

There are many kinds of accurate matching and full-text retrieval in Elasticsearch retrieval, which need to be used according to local conditions according to development requirements.

After reading the above, do you have any further understanding of the case analysis of Elasticsearch implementation class Google advanced retrieval? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report