Link Search Menu Expand Document

Elasticsearch

Start a cluster

mkdir -p odfe
cd odfe

cat << EOF > docker-compose.yml
version: '3'
services:
  odfe-node1:
    image: amazon/opendistro-for-elasticsearch:1.13.2
    container_name: odfe-node1
    environment:
      - discovery.type=single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536 # maximum number of open files for the Elasticsearch user, set to at least 65536 on modern systems
        hard: 65536
    volumes:
      - odfe-data1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9600:9600 # required for Performance Analyzer
    networks:
      - odfe-net
  kibana:
    image: amazon/opendistro-for-elasticsearch-kibana:1.13.2
    container_name: odfe-kibana
    ports:
      - 5601:5601
    expose:
      - "5601"
    environment:
      ELASTICSEARCH_URL: https://odfe-node1:9200
      ELASTICSEARCH_HOSTS: https://odfe-node1:9200
    networks:
      - odfe-net

volumes:
  odfe-data1:

networks:
  odfe-net:
EOF
docker-compose up
curl -XGET --insecure https://localhost:9200 -u admin:admin
{
  "name": "cfef3d2179bb",
  "cluster_name": "docker-cluster",
  "cluster_uuid": "j8hhLnA6QASMIjrh6JWW8g",
  "version": {
    "number": "7.10.2",
    "build_flavor": "oss",
    "build_type": "tar",
    "build_hash": "747e1cc71def077253878a59143c1f785afa92b9",
    "build_date": "2021-01-13T00:42:12.435326Z",
    "build_snapshot": false,
    "lucene_version": "8.7.0",
    "minimum_wire_compatibility_version": "6.8.0",
    "minimum_index_compatibility_version": "6.0.0-beta1"
  },
  "tagline": "You Know, for Search"
}
curl -X POST --insecure \
    'https://localhost:9200/test/_doc/' \
    -u admin:admin \
    -H 'Content-Type: application/json' \
    -d '{
        "count" : 10,
        "ts" : "2020-02-02T12:12:12"
    }' | jq
{
  "_index": "test",
  "_type": "_doc",
  "_id": "M3EfyHoBliFN0Cb42bMK",
  "_version": 1,
  "result": "created",
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  },
  "_seq_no": 0,
  "_primary_term": 1
}