소소한 컴퓨터 이야기

[Elastic Search] 데이터 검색

by Cori

1. 엘라스틱 서치에 존재하는 스냅숏의 목록 확인 

$ curl -XGET "http://localhost:9200/_snapshot/javacafe/_all?pretty" 

 

2. movie-search의 스냅숏 복구 

$ curl -XPOST "http://localhost:9200/_snapshot/javacafe/movie-search/_restore"

 

3. 인덱스 생성하기 (movie_nested)

PUT move_nested
{
  "settings": {
    "number_of_replicas": 1,
    "number_of_shards": 5
  },
  "mappings": {
    "_doc": {
      "properties": {
        "repGenreNm": {
          "type": "keyword"
        },
        "companies": {
          "type": "nested",
          "properties": {
            "companyCd": { "type": "keyword" },
            "companyNm": { "type": "keyword" }
          }
        }
      }
    }
  }
}

 

4. 인덱스 조회

$ GET /_cat/indices/movie_search?v&pretty 

 

5. URI 검색 

· Request Body 검색에 비해 단순하고, 사용이 편리하지만 복잡한 질의문을 입력하기 힘들다. 

· 엘라스틱서치에서 제공하는 모든 검색 옵션을 사용할 수 없다. 

· 웹브라우저를 통해 빠르게 테스트할 수 있다. 

 

6. Request Body 검색

· URI 방식에 비해 다양한 조합의 검색 쿼리 작성 가능 

· 엘라스틱서치가 제공하는 검색 API 모두 활용 가능 

블로그의 정보

코딩하는 오리

Cori

활동하기