my personal notes on Elasticsearch, a Java thing consumed from a .NET context
Elasticsearch is a highly scalable open-source full-text search and analytics engine. It allows you to store, search, and analyze big volumes of data quickly and in near real time. It is generally used as the underlying engine/technology that powers applications that have complex search features and requirements. [docs]
Install Chocolatey package, jdk8
and make sure JAVA_HOME
is correct. Based on what is on the downloads page as of this writing, download the Elasticsearch Zip and extract:
Invoke-WebRequest -Uri https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.zip
Add elasticsearch-6.6.0/bin
to PATH
and run elasticsearch
. By the current convention, the server should be at http://localhost:9200/
:
{
"name": "_RzHa2s",
"cluster_name": "elasticsearch",
"cluster_uuid": "Qjz1mRRIS9uDLxtRK776Ug",
"version": {
"number": "6.6.0",
"build_flavor": "default",
"build_type": "zip",
"build_hash": "a9861f4",
"build_date": "2019-01-24T11:27:09.439740Z",
"build_snapshot": false,
"lucene_version": "7.6.0",
"minimum_wire_compatibility_version": "5.6.0",
"minimum_index_compatibility_version": "5.0.0"
},
"tagline": "You Know, for Search"
}
In case frustration is found with my previous installation approach, you can get into more trouble by not only installing Elasticsearch in the Windows Subsystem for Linux but also using the Amazon-backed Open Distro for Elasticsearch as well😬. There is documentation for the Debian installation process and my variation for version 7.1.1 is only slightly different:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt update
sudo apt install openjdk-11-jdk
Ensure that JAVA_HOME
is set by editing /etc/environment
with a line like:
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64/"
where java-11-openjdk-amd64
is a symlink. For more detail, see “How to set JAVA_HOME for Java?.”📚
wget -qO - https://d3g5vo6xdbdb9a.cloudfront.net/GPG-KEY-opendistroforelasticsearch | sudo apt-key add -
echo "deb https://d3g5vo6xdbdb9a.cloudfront.net/apt stable main" | sudo tee -a /etc/apt/sources.list.d/opendistroforelasticsearch.list
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-7.1.1-amd64.deb
sudo dpkg -i elasticsearch-oss-7.1.1-amd64.deb
sudo apt-get update
sudo apt install opendistroforelasticsearch
Disable all security on the server by editing /etc/elasticsearch/elasticsearch.yml
with these two lines:
opendistro_security.ssl.http.enabled: false
…
opendistro_security.disabled: true
For more detail, see “Disable security.”📚
Finally, because systemctl
is not really a thing in Windows bash, control the elasticsearch
service with these:
sudo /etc/init.d/elasticsearch restart
sudo /etc/init.d/elasticsearch stop
sudo /etc/init.d/elasticsearch start
—otherwise, for Linux:
sudo systemctl start elasticsearch.service
systemctl status elasticsearch.service
sudo systemctl stop elasticsearch.service
Verify that the server is running (and unsecured) with these commands:
curl -XGET https://localhost:9200 -u admin:admin --insecure
curl -XGET https://localhost:9200/_cat/nodes?v -u admin:admin --insecure
curl -XGET https://localhost:9200/_cat/plugins?v -u admin:admin --insecure
Under the ElasticSearch.Tests/
directory will be subdirectories representing the study of official guides.
- my study of the Getting Started guide
The unmet dependencies
error comes from installing opendistroforelasticsearch
with a version number that is not the same as the version of the packages used with the dpkg
command. This issue is detailed on GitHub.
The information in this article might do well here: “How to uninstall a .deb package? ”