docker network create es-net --driver=bridge
docker run -d --name elasticsearch --net es-net -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.13.2
docker run --name kibana --net es-net -p 5601:5601 -e "ELASTICSEARCH_HOSTS=http://elasticsearch:9200" docker.elastic.co/kibana/kibana:7.13.2
POST http://localhost:9200/index-study/people/1
{
"name": "Márcio",
"likes": [ "tibia", "beber", "esporte", "futebol"],
"city": "Araxá",
"state": "SP",
"degree": "Engenharia de Produção",
"contry": "Brazil"
}
POST http://localhost:9200/index-study/people
{
"name": "Tadeu",
"likes": [ "exercicios", "academia", "esporte", "tecnologia"],
"city": "Araxá",
"state": "MG",
"degree": "Ciência da Computação",
"contry": "Brazil"
}
{
"name": "José",
"likes": [ "exercicios", "academia", "esporte", "tecnologia"],
"city": "São José do rio preto",
"state": "SP",
"degree": "Ciência da Computação",
"contry": "Brazil"
}
{
"name": "Branco",
"likes": [ "exercicios", "academia", "esporte", "tecnologia"],
"city": "São José do rio preto",
"state": "SP",
"degree": "Ciência da Computação",
"contry": "Brazil"
}
PUT http://localhost:9200/index-study/_settings
{
"index": {
"number_of_replicas": 0
}
}
GET http://localhost:9200/index-study/people/_count
Response
{
"count": 3,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
}
}
GET http://localhost:9200/index-study/people/_search?q=Tadeu
Response
{
"took": 18,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 1.2039728,
"hits": [
{
"_index": "index-study",
"_type": "people",
"_id": "TSG9aHoB_wW61CPyiUqm",
"_score": 1.2039728,
"_source": {
"name": "Tadeu",
"likes": [
"exercicios",
"academia",
"esporte",
"tecnologia"
],
"city": "Araxá",
"state": "MG",
"degree": "Ciência da Computação",
"contry": "Brazil"
}
}
]
}
}
POST http://localhost:9200/index-study/people/TSG9aHoB_wW61CPyiUqm
Body
{
"doc": {
"nome": "Tadeu Tupinambá"
}
}
Response
{
"_index": "index-study",
"_type": "people",
"_id": "TSG9aHoB_wW61CPyiUqm",
"_version": 2,
"result": "updated",
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"_seq_no": 4,
"_primary_term": 1
}