Deployment Services

docker run start-up elastic service
docker pull elasticsearch:6.7.2 docker run -d -p 9200:9200 -p 9300:9300 -e
"discovery.type=single-node" elasticsearch:6.7.2
docker-compose.yml How to deploy
version: '2.2' services: elasticsearch: image:
docker.elastic.co/elasticsearch/elasticsearch:6.7.2 container_name:
elasticsearch environment: - cluster.name=docker-cluster -
bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" ulimits: memlock:
soft: -1 hard: -1 volumes: - esdata1:/usr/share/elasticsearch/data ports: -
9200:9200 networks: - esnet elasticsearch2: image:
docker.elastic.co/elasticsearch/elasticsearch:6.7.2 container_name:
elasticsearch2 environment: - cluster.name=docker-cluster -
bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" -
"discovery.zen.ping.unicast.hosts=elasticsearch" ulimits: memlock: soft: -1
hard: -1 volumes: - esdata2:/usr/share/elasticsearch/data networks: - esnet
volumes: esdata1: driver: local esdata2: driver: local networks: esnet:
elastic Common commands

Check whether the cluster is healthy
  curl 'localhost:9200/_cat/health?v'
Get the node list of the cluster
  curl 'localhost:9200/_cat/nodes?v'
List all indexes
curl 'localhost:9200/_cat/indices?v'
Create a customer Index of
 curl -XPUT 'localhost:9200/customer?pretty'
Index to customer, Type is external, Add data
  curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '   {    "name":
"John Doe"   }'
get data

obtain customer Type under index is external,id by 1 Data for ,pretty The parameter indicates that the returned result format is beautiful .
curl -XGET 'localhost:9200/customer/external/1?pretty'
Delete index DELETE
curl -XDELETE 'localhost:9200/customer?pretty'
Modify data , If not , Just add
curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '   {    "name":
"John Doe"   }'
Update data
  curl -XPOST 'localhost:9200/customer/external/1/_update?pretty' -d '   {   
"doc": { "name": "Jane Doe", "age": 20 }   }'
Delete a record data
curl -XDELETE 'localhost:9200/customer/external/2?pretty'

Technology
©2019-2020 Toolsou All rights reserved,
Huawei 2021 session Hardware Engineer Logical post (FPGA) Super detailed surface !!!Vue-element-admin upgrade ui edition virtual machine VMware Download and install the most detailed tutorial !C++ Move constructor and copy constructor sound of dripping water java Backstage interview pygame Realize full screen mode and adjustable window size mysql Database setting character set configuration modification my.ini file (windows)30 What's the experience of being a junior programmer at the age of 20 C++ Multithreading programming ( Summary of common functions and parameters )python_ cherry tree