Skip to content

Setting up for Elasticsearch

ivan provalov edited this page Jul 14, 2016 · 2 revisions

Local Properties

Modify your local properties file with Elasticsearch specific properties, these will be used by our app to talk to Elasticsearch "/tmp/config-local.properties":

search.query.testing.enginePort=9200

search.query.testing.engineServlet=

search.query.testing.engineType=es

Download and Install Elasticsearch

See the Elasticsearch download instructions here:

https://www.elastic.co/downloads/elasticsearch

We used elasticsearch-2.3.3. Download to ‘~/developer/’ and start the app:

cd ~/developer/elasticsearch-2.3.3/

./bin/elasticsearch

Create New Index - No ASCII Folding

curl -XPUT http://localhost:9200/qtest -H 'Content-type:application/json' -d '{ "settings": { "analysis": {"filter": {"title_contains_ngrams": {"type": "nGram", "min_gram": "1", "max_gram": "50"}}, "analyzer": { "contains_title": {"filter": [ "standard", "lowercase", "title_contains_ngrams" ], "type": "custom", "tokenizer": "standard" }, "full_title": {"filter": ["standard", "lowercase"], "type": "custom", "tokenizer": "standard"} } } }, "mappings": { "test_doc": { "properties": { "id": { "type": "string", "index": "not_analyzed"}, "query_testing_type": { "type": "string", "index": "not_analyzed"}, "title_en": {"type": "string", "analyzer": "contains_title", "search_analyzer": "full_title"}, "title_sv": {"type": "string", "analyzer": "contains_title", "search_analyzer": "full_title"} } } } }'

###ASCII Folding Change (Only for Test 2)

curl -X POST 'http://localhost:9200/qtest/_close'

curl -XPUT http://localhost:9200/qtest/_settings -H 'Content-type:application/json' -d '{ "analysis": { "filter": { "title_contains_ngrams": { "type": "nGram", "min_gram": "1", "max_gram": "50" } }, "analyzer": { "contains_title": { "filter": [ "standard", "lowercase", "asciifolding", "title_contains_ngrams" ], "type": "custom", "tokenizer": "standard" }, "full_title": { "filter": [ "standard", "lowercase", "asciifolding" ], "type": "custom", "tokenizer": "standard" } } } }'

curl -X POST 'http://localhost:9200/qtest/_open'