[post] http://localhost:9200/myboard/_doc/1,
{
"id":"123123",
"title":"title",
"contents":"contents"
}
myboard 인덱스에 모든 데이터 조회
myboard 인덱스에 1번 데이터 조회
[post] http://localhost:9200/myboard/_doc/1,
{
"id":"12321312",
"title":"수정",
"contents":"contents"
}
{
"acknowledged": true
}
query에서는 token이라는 개념이 들어간다.
token은 공백을 기준으로 단어를 나누어 검색을 하게 된다.
description에 키워드가 들어간 검색 쿼리
// 쿼리
{
"query":{
"match":{
"description":"Best"
}
}
}
// 결과
{
"took": 445,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 0.84290004,
"hits": [
{
"_index": "myproduct09",
"_type": "_doc",
"_id": "1",
"_score": 0.84290004,
"_source": {
"name": "최신마우스",
"description": "안녕하세요. BestShop입니다! 국내 최고 Best 상품만 판매합니다!",
"price": 10000
}
}
]
}
}
//쿼리
http://localhost:9200/myproduct09/_analyze
body
{
"text":"안녕하세요. BestShop입니다! 국내 최고 Best 상품만 판매합니다!",
}
//결과
{
"tokens": [
{
"token": "안녕하세요",
"start_offset": 0,
"end_offset": 5,
"type": "<HANGUL>",
"position": 0
},
{
"token": "bestshop입니다",
"start_offset": 7,
"end_offset": 18,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "best",
"start_offset": 20,
"end_offset": 24,
"type": "<ALPHANUM>",
"position": 2
}
]
}
x