오락기/ELK
elasticsearch put / delete / post
문방구앞오락기
2018. 5. 11. 15:48
INDEX
GET
PUT
DELETE
DOCUMENT
POST -> INDEX가 없어도 타입과 값을 명시하면 INDEX를 PUT하지않아도 생성가능
curl -XPUT http://localhost:9200/classes/class/1/ -d '
> {"title":"Algorithm","professor":"John"}'
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
에러가 떠러짐
보니 content - type 가 정해지지않아서 그런거같다. 6.0이전에는 가능했는데 그 이후로는 안된단다.
그래서 타입을 정해주고 해보자
Json 파일을 이용한 POST
curl -XPOST http://localhost:9200/test/1/ -H 'Content-Type:application/json' -d @test.json