Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

글또 게시글 인덱싱 #31

Open
dldydtjs2965 opened this issue May 4, 2024 · 0 comments
Open

글또 게시글 인덱싱 #31

dldydtjs2965 opened this issue May 4, 2024 · 0 comments

Comments

@dldydtjs2965
Copy link

dldydtjs2965 commented May 4, 2024

개요

  • 게시물을 ElasticSearch에 인덱싱하기 위한 API 개발
  • 요청한 링크의 게시물을 스크래핑하고 본문의 내용을 검색엔진에 저장

개발 설계

인덱싱 플로우

image

인덱스 설계

인덱스 매핑 구조

  • id: keyword
  • user_id: keyword
  • user_name: keyword
  • title: text
  • url: keyword
  • due_date: date
  • category: keyword
  • description: text
  • tags: keyword
  • content: text
  • og_title: text
  • og_image: keyword
  • og_description: text
  • created_at: date
  • updated_at: date

인덱스 생성 명령어

PUT articles
{
  "mappings": {
    "properties": {
      "id": {
        "type": "keyword"
      },
      "user_id": {
        "type": "keyword"
      },
      "user_name": {
        "type": "keyword"
      },
      "title": {
        "type": "text"
      },
      "url": {
        "type": "text"
      },
      "due_date": {
        "type": "date"
      },
      "category": {
        "type": "keyword"
      },
      "description": {
        "type": "text"
      },
      "tags": {
        "type": "keyword"
      },
      "content": {
        "type": "text",
        "analyzer": "korean_analyzer",
        "fields": {
          "english": {
            "type": "text",
            "analyzer": "standard"
          }
        }
      },
      "created_at": {
        "type": "date"
      },
      "updated_at": {
        "type": "date"
      }
    }
  },
  "settings": {
    "analysis": {
      "analyzer": {
        "korean_analyzer": {
          "type": "custom",
          "tokenizer": "nori_tokenizer",
          "filter": [
            "kr_stop_filter"
          ]
        }
      },
      "tokenizer": {
        "nori_tokenizer": {
          "type": "nori_tokenizer",
          "decompound_mode": "mixed",
          "discard_punctuation": "true"
        }
      },
      "filter": {
        "kr_stop_filter": {
          "type": "nori_part_of_speech",
          "stoptags": [
            "E",
            "IC",
            "J",
            "MAG",
            "MM",
            "NA",
            "NR",
            "SC",
            "SE",
            "SF",
            "SH",
            "SL",
            "SN",
            "SP",
            "SSC",
            "SSO",
            "SY",
            "UNA",
            "UNKNOWN",
            "VA",
            "VCN",
            "VCP",
            "VSV",
            "VV",
            "VX",
            "XPN",
            "XR",
            "XSA",
            "XSN",
            "XSV"
          ]
        }
      }
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant