ElasticSearch¶
See the doc:app-search app documentation for python code.
For building the fuzzy match code, I found the following articles very useful:
Pillar¶
Create a search
sls
:
# config/search.sls
search:
True
And add it to the config for the server e.g:
# top.sls
'test-a':
- config.search
- sites.my
Install¶
For a development workstation, see elasticsearch.
Install the phoentic search plugins (See Plugins, Re-Install below).
Plugins¶
Re-Install¶
Ubuntu 14.04:
cd /usr/share/elasticsearch
bin/plugin remove analysis-phonetic
bin/plugin install analysis-phonetic
service elasticsearch restart
Note
These commands were copied from the Salt state, search/init.sls
Ubuntu 16.04, Elasticsearch version 6:
cd /usr/share/elasticsearch
bin/elasticsearch-plugin remove analysis-phonetic
bin/elasticsearch-plugin install analysis-phonetic
service elasticsearch restart
Tip
For more information on the Phonetic Plugins, see Custom Analyzers and Phonetic Analysis Plugin
Warning
The plugins will not update when a new version of ElasticSearch is
installed by apt-get
.
List¶
cd /usr/share/elasticsearch
bin/plugin list
Background Tasks¶
See doc:app-search
Update to version 6¶
No handler for type [string]¶
From No handler for type [string] declared on field [name]
Elasticsearch has dropped the string
type and is now using text
, so
your code should be something like this:
'mappings': {
self.DOC_TYPE: {
"properties": {
"job_role": {
"type": "text",
"analyzer": "my_analyzer",
Plugin¶
If you cannot install a plugin because a previous version is still installed, then remove ElasticSearch before re-installing.
Will not start (after installing an earlier version)¶
Check the logs in:
/var/log/syslog
It seems that the config is driven from:
/etc/default/elasticsearch
To solve this issue I ran the following commands:
apt purge elasticsearch
rm -r /var/lib/elasticsearch/