Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.2 kB
1
Indexable
Never
version: "3.7"
services:
  elasticsearch:
    container_name: es-container
    image: elasticsearch:8.6.2
    environment:
      - xpack.security.enabled=false
      - discovery.type=single-node
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    ports:
      - '127.0.0.1:9200:9200'
    restart: always
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    volumes:
      - elasticsearch-data:/usr/share/elasticsearch/data
    command: >
      bash -c '
      until curl -sS 'http://elasticsearch:9200/_cat/health?h=status' | grep -q 'green\|yellow'; do
         sleep 1
      done
      curl -X PUT 'http://elasticsearch:9200/movies' -H 'Content-Type: application/json' -d '
              {
              "settings": {
      	    "refresh_interval": "1s",
      	    "analysis": {
      	      "filter": {
      		"english_stop": {
      		  "type":       "stop",
      		  "stopwords":  "_english_"
      		},
      		"english_stemmer": {
      		  "type": "stemmer",
      		  "language": "english"
      		},
      		"english_possessive_stemmer": {
      		  "type": "stemmer",
      		  "language": "possessive_english"
      		},
      		"russian_stop": {
      		  "type":       "stop",
      		  "stopwords":  "_russian_"
      		},
      		"russian_stemmer": {
      		  "type": "stemmer",
      		  "language": "russian"
      		}
      	      },
      	      "analyzer": {
      		"ru_en": {
      		  "tokenizer": "standard",
      		  "filter": [
      		    "lowercase",
      		    "english_stop",
      		    "english_stemmer",
      		    "english_possessive_stemmer",
      		    "russian_stop",
      		    "russian_stemmer"
      		  ]
      		}
      	      }
      	    }
      	  },
      	  "mappings": {
      	    "dynamic": "strict",
      	    "properties": {
      	      "id": {
      		"type": "keyword"
      	      },
      	      "imdb_rating": {
      		"type": "float"
      	      },
      	      "genre": {
      		"type": "keyword"
      	      },
      	      "title": {
      		"type": "text",
      		"analyzer": "ru_en",
      		"fields": {
      		  "raw": {
      		    "type":  "keyword"
      		  }
      		}
      	      },
      	      "description": {
      		"type": "text",
      		"analyzer": "ru_en"
      	      },
      	      "director": {
      		"type": "text",
      		"analyzer": "ru_en"
      	      },
      	      "actors_names": {
      		"type": "text",
      		"analyzer": "ru_en"
      	      },
      	      "writers_names": {
      		"type": "text",
      		"analyzer": "ru_en"
      	      },
      	      "actors": {
      		"type": "nested",
      		"dynamic": "strict",
      		"properties": {
      		  "id": {
      		    "type": "keyword"
      		  },
      		  "name": {
      		    "type": "text",
      		    "analyzer": "ru_en"
      		  }
      		}
      	      },
      	      "writers": {
      		"type": "nested",
      		"dynamic": "strict",
      		"properties": {
      		  "id": {
      		    "type": "keyword"
      		  },
      		  "name": {
      		    "type": "text",
      		    "analyzer": "ru_en"
      		  }
      		}
      	      }
      	    }
      	  }
      	}'