Elasticsearch Character Filters
Elasticsearch
20
character
1
filters
1
Male avatar

loveprogramming viết ngày 22/05/2021

https://grokonez.com/elasticsearch/elasticsearch-character-filters

Elasticsearch Character Filters

Elasticsearch Character Filters preprocess (adding, removing, or changing) the stream of characters before it is passed to Tokenizer. In this tutorial, we're gonna look at 3 types of Character Filters: HTML Strip, Mapping, Pattern Replace that are very important to build Customer Analyzers.

1. HTML Strip Character Filter

html_strip character filter can:

  • strip out HTML elements (like <b>)
  • replace HTML entities with their decoded value (&amp; becomes &).

For example:


POST _analyze
{
  "tokenizer":      "keyword", 
  "char_filter":  [ "html_strip" ],
  "text": "

JavaSampleApproach's tutorials are so helpful!

" }

Terms:


[ \nJavaSampleApproach's tutorials are so helpful!\n ]

Configuration

escaped_tags: array of HTML tags which should not be stripped.

For example, we want to to leave <b> and <p> tags in place:


PUT jsa_index_char_filter_html
{
  "settings": {
    "analysis": {
      "analyzer": {
        "jsa_analyzer": {
          "tokenizer": "keyword",
          "char_filter": ["jsa_char_filter"]
        }
      },
      "char_filter": {
        "jsa_char_filter": {
          "type": "html_strip",
          "escaped_tags": ["b", "p"]
        }
      }
    }
  }
}

POST jsa_index_char_filter_html/_analyze
{
  "analyzer": "jsa_analyzer",
  "text": "

JavaSampleApproach's tutorials are so helpful!

" }

More at:

https://grokonez.com/elasticsearch/elasticsearch-character-filters

Elasticsearch Character Filters

Bình luận


White
{{ comment.user.name }}
Bỏ hay Hay
{{comment.like_count}}
Male avatar
{{ comment_error }}
Hủy
   

Hiển thị thử

Chỉnh sửa

Male avatar

loveprogramming

545 bài viết.
97 người follow
Kipalog
{{userFollowed ? 'Following' : 'Follow'}}
Cùng một tác giả
Male avatar
1 0
Tutorial Link: (Link) (Ảnh) Django is a Pythonbased free and opensource web framework that follows the modeltemplateview architectural pattern. A...
loveprogramming viết 11 tháng trước
1 0
Male avatar
1 0
https://loizenai.com/angular11nodejspostgresqlcrudexample/ Angular 11 Node.js PostgreSQL Crud Example (Ảnh) Tutorial: “Angular 11 Node.js Postg...
loveprogramming viết 9 tháng trước
1 0
Male avatar
1 0
Angular Spring Boot jwt Authentication Example Github https://loizenai.com/angularspringbootjwt/ (Ảnh) Tutorial: ” Angular Spring Boot jwt Authe...
loveprogramming viết 9 tháng trước
1 0
{{like_count}}

kipalog

{{ comment_count }}

bình luận

{{liked ? "Đã kipalog" : "Kipalog"}}


Male avatar
{{userFollowed ? 'Following' : 'Follow'}}
545 bài viết.
97 người follow

 Đầu mục bài viết

Vẫn còn nữa! x

Kipalog vẫn còn rất nhiều bài viết hay và chủ đề thú vị chờ bạn khám phá!