Basic setup for elasticsearch (full-text-search)

this is a note how i did setup my owncloud with full text search app and elasticsearch:
i have documented my base owncloud setup in the topic Recommend way to setup owncloud with collabora code on linux VServer
my newes addition is the elasticsearch integration:
base is the official installation instruction for docker combined with the newer 7.10 docker-compose.yml
my ~/elasticsearch/docker-compose.yml file:

version: '3.5'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - discovery.type=single-node
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.security.enabled=false
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data01:/usr/share/elasticsearch/data
      - esplugins01:/usr/share/elasticsearch/plugins
    ports:
      # lock to localhost
      - 127.0.0.1:9200:9200
    networks:
      - elastic

volumes:
  data01:
    driver: local
  esplugins01:
    driver: local

networks:
  elastic:
    # connect to owncloud network
    name: owncloud-docker_default

key aspects to look for:

  • disable the xpack security - otherwise you can not connect anonymously…
  • setup network to connect to default owncloud network

if elasticsearch is running i have installed the ingest-attachment plugin:
based on information i found at this post)

user@yourserver:~$ docker exec -it es01 /bin/bash
[elasticsearch@8cbxxxx86 ~]$ bin/elasticsearch-plugin install ingest-attachment
-> Downloading ingest-attachment from elastic
[=================================================] 100%?? 
ERROR: plugin directory [/usr/share/elasticsearch/plugins/ingest-attachment] already exists; if you need to update the plugin, uninstall it first using command 'remove ingest-attachment'
[elasticsearch@8cbxxxx86 ~]$ 
[elasticsearch@8cbxxxx86 ~]$ exit
exit
user@yourserver:~$

(ok in the output you see i have already successfully installed the plugin in a previous run… :wink:
then restart your docker-compose setup.
there are other options for this installation i did not try

if this is all working check with

user@yourserver:~$ curl -X GET "http://localhost:9200/_cluster/health?pretty=true"
{
  "cluster_name" : "es-docker-cluster",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 8,
  "active_shards" : 8,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 7,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 53.333333333333336
}

now you can also check from within your running owncloud docker if you can reach your elasticsearch setup:

user@yourserver:~$ docker exec -it owncloud-docker_owncloud_1 /bin/bash

root@987xxxxxc: /var/www/owncloud # curl -X GET "http://es01:9200/_cluster/health?pretty=true"
{
  "cluster_name" : "es-docker-cluster",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 8,
  "active_shards" : 8,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 7,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 53.333333333333336
}

root@987xxxxxc: /var/www/owncloud # exit
exit
user@yourserver:~$ 

with this setup you can use es01:9200 as address in the owncloud search app settings:

i hope that this helps someone on there way with the docker setup…

sunny greetings
stefan

2 Likes