Elastic 가이드북
  • Elastic 가이드 북
  • 1. 서문
    • 1.1 Elastic Stack 소개
      • 1.1.1 Elasticsearch
      • 1.1.2 Logstash
      • 1.1.3 Kibana
      • 1.1.4 Beats
  • 2. Elasticsearch 시작하기
    • 2.1 데이터 색인
    • 2.2 설치 및 실행
      • 2.2.1 다운로드 설치 및 실행
      • 2.2.2 Unix RPM (yum) 설치 및 실행
      • 2.2.3 윈도우 운영체제에서 MSI 파일로 설치
    • 2.3 elasticsearch 환경 설정
      • 2.3.1 jvm.options
      • 2.3.2 elasticsearch.yml
      • 2.3.3 노드의 역할 : master, data, ingest, ml
      • 2.3.4 커맨드 라인 설정
  • 3. Elasticsearch 시스템 구조
    • 3.1 클러스터 구성
    • 3.2 인덱스와 샤드 - Index & Shards
    • 3.3 마스터 노드와 데이터 노드 - Master & Data Nodes
  • 4. Elasticsearch 데이터 처리
    • 4.1 REST API
    • 4.2 CRUD - 입력, 조회, 수정, 삭제
    • 4.3 벌크 API - _bulk API
    • 4.4 검색 API - _search API
  • 5. 검색과 쿼리 - Query DSL
    • 5.1 풀 텍스트 쿼리 - Full Text Query
    • 5.2 Bool 복합 쿼리 - Bool Query
    • 5.3 정확도 - Relevancy
    • 5.4 Bool : Should
    • 5.5 정확값 쿼리 - Exact Value Query
    • 5.6 범위 쿼리 - Range Query
  • 6. 데이터 색인과 텍스트 분석
    • 6.1 역 인덱스 - Inverted Index
    • 6.2 텍스트 분석 - Text Analysis
    • 6.3 애널라이저 - Analyzer
      • 6.3.1 _analyze API
      • 6.3.2 Term 쿼리
      • 6.3.3 사용자 정의 애널라이저 - Custom Analyzer
      • 6.3.4 텀 벡터 - _termvectors API
    • 6.4 캐릭터 필터 - Character Filter
      • 6.4.1 HTML Strip
      • 6.4.2 Mapping
      • 6.4.3 Pattern Replace
    • 6.5 토크나이저 - Tokenizer
      • 6.5.1 Standard, Letter, Whitespace
      • 6.5.2 UAX URL Email
      • 6.5.3 Pattern
      • 6.5.4 Path Hierarchy
    • 6.6 토큰 필터 - Token Filter
      • 6.6.1 Lowercase, Uppercase
      • 6.6.2 Stop
      • 6.6.3 Synonym
      • 6.6.4 NGram, Edge NGram, Shingle
      • 6.6.5 Unique
    • 6.7 형태소 분석 - Stemming
      • 6.7.1 Snowball
      • 6.7.2 노리 (nori) 한글 형태소 분석기
  • 7. 인덱스 설정과 매핑 - Settings & Mappings
    • 7.1 설정 - Settings
    • 7.2 매핑 - Mappings
      • 7.2.1 문자열 - text, keyword
      • 7.2.2 숫자 - long, double ...
      • 7.2.3 날짜 - date
      • 7.2.4 불리언 - boolean
      • 7.2.5 Object 와 Nested
      • 7.2.6 위치 정보 - Geo
      • 7.2.7 기타 필드 타입 - IP, Range, Binary
    • 7.3 멀티 (다중) 필드 - Multi Field
  • 8. 집계 - Aggregations
    • 8.1 메트릭 - Metrics Aggregations
    • 8.2 버킷 - Bucket Aggregations
    • 8.3 하위 - sub-aggregations
    • 8.4 파이프라인 - Pipeline Aggregations
Powered by GitBook
On this page

Was this helpful?

  1. 6. 데이터 색인과 텍스트 분석
  2. 6.5 토크나이저 - Tokenizer

6.5.2 UAX URL Email

이 문서의 허가되지 않은 무단 복제나 배포 및 출판을 금지합니다. 본 문서의 내용 및 도표 등을 인용하고자 하는 경우 출처를 명시하고 김종민(kimjmin@gmail.com)에게 사용 내용을 알려주시기 바랍니다.

주로 사용되는 Standard 토크나이저도 @, / 같은 특수문자는 공백과 마찬가지로 제거하고 분리합니다. 그런데 요즘의 블로그 포스트나 신문기사 같은 텍스트 들에는 이메일 주소 또는 웹 URL 경로 등이 삽입되어 있는 경우가 상당히 많습니다. 이 경우 Standard 토크나이저를 사용하면 이메일 주소등이 정상적으로 인식되지 않아 문제가 될 수 있는데, 이를 방지하기 위해 사용 가능한 것이 UAX URL Email 토크나이저 입니다.

UAX URL Email 토크나이저는 이메일 주소와 웹 URL 경로는 분리하지 않고 그대로 하나의 텀으로 저장을 합니다. 다음은 "email address is my-name@email.com and website is https://www.elastic.co" 문장을 각각 Standard 그리고 UAX URL Email 토크나이저로 분리 한 결과입니다.

standard 토크나이저로 문장 분석
GET _analyze
{
  "tokenizer": "standard",
  "text": "email address is my-name@email.com and website is https://www.elastic.co"
}
standard 토크나이저로 문장 분석 결과
{
  "tokens" : [
    {
      "token" : "email",
      "start_offset" : 0,
      "end_offset" : 5,
      "type" : "<ALPHANUM>",
      "position" : 0
    },
    {
      "token" : "address",
      "start_offset" : 6,
      "end_offset" : 13,
      "type" : "<ALPHANUM>",
      "position" : 1
    },
    {
      "token" : "is",
      "start_offset" : 14,
      "end_offset" : 16,
      "type" : "<ALPHANUM>",
      "position" : 2
    },
    {
      "token" : "my",
      "start_offset" : 17,
      "end_offset" : 19,
      "type" : "<ALPHANUM>",
      "position" : 3
    },
    {
      "token" : "name",
      "start_offset" : 20,
      "end_offset" : 24,
      "type" : "<ALPHANUM>",
      "position" : 4
    },
    {
      "token" : "email.com",
      "start_offset" : 25,
      "end_offset" : 34,
      "type" : "<ALPHANUM>",
      "position" : 5
    },
    {
      "token" : "and",
      "start_offset" : 35,
      "end_offset" : 38,
      "type" : "<ALPHANUM>",
      "position" : 6
    },
    {
      "token" : "website",
      "start_offset" : 39,
      "end_offset" : 46,
      "type" : "<ALPHANUM>",
      "position" : 7
    },
    {
      "token" : "is",
      "start_offset" : 47,
      "end_offset" : 49,
      "type" : "<ALPHANUM>",
      "position" : 8
    },
    {
      "token" : "https",
      "start_offset" : 50,
      "end_offset" : 55,
      "type" : "<ALPHANUM>",
      "position" : 9
    },
    {
      "token" : "www.elastic.co",
      "start_offset" : 58,
      "end_offset" : 72,
      "type" : "<ALPHANUM>",
      "position" : 10
    }
  ]
}
uax_url_email 토크나이저로 문장 분석
GET _analyze
{
  "tokenizer": "uax_url_email",
  "text": "email address is my-name@email.com and website is https://www.elastic.co"
}
letter 토크나이저로 문장 분석 결과
{
  "tokens" : [
    {
      "token" : "email",
      "start_offset" : 0,
      "end_offset" : 5,
      "type" : "<ALPHANUM>",
      "position" : 0
    },
    {
      "token" : "address",
      "start_offset" : 6,
      "end_offset" : 13,
      "type" : "<ALPHANUM>",
      "position" : 1
    },
    {
      "token" : "is",
      "start_offset" : 14,
      "end_offset" : 16,
      "type" : "<ALPHANUM>",
      "position" : 2
    },
    {
      "token" : "my-name@email.com",
      "start_offset" : 17,
      "end_offset" : 34,
      "type" : "<EMAIL>",
      "position" : 3
    },
    {
      "token" : "and",
      "start_offset" : 35,
      "end_offset" : 38,
      "type" : "<ALPHANUM>",
      "position" : 4
    },
    {
      "token" : "website",
      "start_offset" : 39,
      "end_offset" : 46,
      "type" : "<ALPHANUM>",
      "position" : 5
    },
    {
      "token" : "is",
      "start_offset" : 47,
      "end_offset" : 49,
      "type" : "<ALPHANUM>",
      "position" : 6
    },
    {
      "token" : "https://www.elastic.co",
      "start_offset" : 50,
      "end_offset" : 72,
      "type" : "<URL>",
      "position" : 7
    }
  ]
}

"tokenizer": "uax_url_email" 로 설정하여 텍스트를 분석하면 이메일 주소와 웹 URL은 그대로 남아있는 것을 확인할 수 있습니다.

Previous6.5.1 Standard, Letter, WhitespaceNext6.5.3 Pattern

Last updated 5 years ago

Was this helpful?