PUT /products
PUT /products/_mappings { "properties": { "name": { "type": "text" } } }
# 도큐먼트 삽입 # POST /{인덱스명}/_doc POST /products/_doc { "name": "Apple 2025 맥북 에어 13 M4 10코어" }
# 모든 도큐먼트 조회 GET /products/_search
# 특정 조건을 만족하는 도큐먼트 조회 # (name 필드에 '맥북 에어 13 M4'가 포함된 도큐먼트 조회) GET /products/_search { "query": { "match": { "name": "맥북 에어 13 M4" } } }
{ "took": 4, "timed_out": false, "_shards": { "total": 1, "successful": 1, "skipped": 0, "failed": 0 }, "hits": { "total": { "value": 1, "relation": "eq" }, "max_score": 1.1507283, # 조건을 만족하는 도큐먼트 "hits": [ { # _index : 인덱스명 "_index": "products", # 데이터를 저장하면서 자동으로 생성된 '랜덤 고유 ID' "_id": "hU2MZ5YB5XfvBpblxof6", "_score": 1.1507283, # _source : 저장한 데이터가 들어있는 필드 "_source": { "name": "Apple 2025 맥북 에어 13 M4 10코어" } } ] } }
GET /products/_search { "query": { "match": { "name": "맥북 13 에어 M4" } } }
{ "took": 3, "timed_out": false, "_shards": { "total": 1, "successful": 1, "skipped": 0, "failed": 0 }, "hits": { "total": { "value": 1, "relation": "eq" }, "max_score": 1.1507283, "hits": [ { "_index": "products", "_id": "hU2MZ5YB5XfvBpblxof6", "_score": 1.1507283, "_source": { "name": "Apple 2025 맥북 에어 13 M4 10코어" } } ] } }