Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Attic : Configure NginX for Keycloak on OS X

Attila Levente EGYEDI edited this page Mar 22, 2017 · 1 revision

Install the Elasticsearch search server, preferably using Homebrew:

brew install homebrew/versions/elasticsearch23

Modify the elasticsearch.yml file (in '/usr/local/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

Install Kibana and Sense. Sense is a handy console for interacting with the REST API of Elasticsearch. Sense is a Kibana app, so you will first need to install Kibana and then install Sense:

$ brew install kibana
$ kibana plugin --install elastic/sense

In order to start Kibana, just type:

$ kibana

You can access to Sense using your browser: http://localhost:5601/app/sense.

Configure Elasticsearch

Cedar Search (cedar-search index)

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

Value Recommender (cedar index)

More info about the Value Recommender Server here.

We will use Sense 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.

PUT /cedar
{
  "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

Clone this wiki locally