-
Notifications
You must be signed in to change notification settings - Fork 1
Attic : Install and Configure Elasticsearch on RHEL 6.6
Download the Elasticsearch RPM package (version 2.1.2) from the Elasticsearch website and install it:
wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticsearch/2.1.2/elasticsearch-2.1.2.rpm
rpm -ivh elasticsearch-2.1.2.rpm
Install the Elasticsearch search server, preferably using Homebrew:
brew install elasticsearch21
Modify the elasticsearch.yml
file in /etc/elasticsearch
to start Elasticsearch on the elasticsearch_cedar
cluster:
cluster.name: elasticsearch_cedar
Add or change the below line to enable script execution:
script.engine.groovy.inline.search: on
Start Elasticsearch:
elasticsearch
Configuration to work with the cedar-search index:
- Cluster: elasticsearch_cedar
- Index: cedar-search
- Type: resources
Some useful queries:
Show all resources: GET cedar-search/resources/_search
Show mappings: GET cedar-search/_mapping/resources
More info about the Value Recommender Server here.
We will use curl
to define a custom analyzer and apply it using a dynamic template. The default tokenizer used by Elasticsearch splits each string into individual words, but that default behavior is not appropriate for our value recommendation functionality. We need that the system recommends full values (e.g. "Longitudinal Study") instead of splitting them into individual words (e.g. "Longitudinal", "Study"). We use the keyword tokenizer to output exactly the same string as it received, without any tokenization. The lowercase filter normalizes the text to lower case. We also use a dynamic template to apply our custom analyzer to all fields.
$ curl -XPUT 'http://localhost:9200/cedar' -d '
{
"settings":{
"index":{
"analysis":{
"analyzer":{
"analyzer_keyword":{
"tokenizer":"keyword",
"filter":"lowercase"
}
}
}
}
},
"mappings": {
"template_instances": {
"dynamic_templates": [
{
"my_template": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"analyzer":"analyzer_keyword"
}
}
}
]
}
}
}
Configuration to work with the cedar index:
- Cluster: elasticsearch_cedar
- Index: cedar
- Type: template_instances
Some useful queries:
Cluster health: GET _cluster/health
List all indices: GET _cat/indices/?v
Get all types and instances: GET _mapping
Get all documents in a given index, of a particular type: GET {cluster_name}/{index_name}/_search
Example: GET cedar/template_instances/_search
Delete an index: DELETE {index_name}
Example: DELETE cedar