#1 . index create
#!/bin/bash

curl -X PUT 'http://192.168.240.10:9200/test_index_1?pretty' -H 'Content-Type: application/json' -d '
{
        "settings" : {
                "number_of_shards" : 3,
                "number_of_replicas" : 1
        },
        "mappings" : {
                "doc" : {
                        "properties" : {
                                "age" : { "type" : "integer" },
                                "name" : { "type" : "text" }
                        }
                }
        }
}'

#2 .data Insert
#!/bin/bash

curl -X POST 'http://192.168.240.10:9200/test_index_1/doc?pretty' -H 'Content-Type: application/json' -d '
{
  "age" : 31,
  "name" : "kimjh"
}'

#3 update 
- field 추가
onfSE2oBZ6r8F2QOkMRS
#!/bin/bash

curl -X POST 'http://192.168.240.10:9200/test_index_1/doc/onfSE2oBZ6r8F2QOkMRS/_update?pretty' -H 'Content-Type: application/json' -d '
{
  "doc" : {
    "phone" : "032-000-0000"
  }
}'

---------------------------------
#!/bin/bash

curl -X POST 'http://192.168.240.10:9200/test_index_1/doc/onfSE2oBZ6r8F2QOkMRS/_update?pretty' -H 'Content-Type: application/json' -d '
{
  "script" : "ctx._source.age += 5"
}'

'ELK > elasticsearch' 카테고리의 다른 글

elastic 불용어 테스트  (0) 2019.05.01
python + bulk + insert + code  (0) 2019.04.24
elastic basic #2  (0) 2019.04.22
elastic basic #1  (0) 2019.04.22
python ( elasticsearch - search template )  (0) 2019.04.20