Elasticsearch: Difference between revisions
link to Kibana article |
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight" |
||
| Line 76: | Line 76: | ||
==Production Configuration== | ==Production Configuration== | ||
ElasticSearch looks for a configuration file to include, and uses a search path for that include. You can specify it on the command-line; through an environment variable; or just make sure that your file is found in the search path. (My default was found at /usr/share/elasticsearch/bin/elasticsearch.in.sh) | ElasticSearch looks for a configuration file to include, and uses a search path for that include. You can specify it on the command-line; through an environment variable; or just make sure that your file is found in the search path. (My default was found at /usr/share/elasticsearch/bin/elasticsearch.in.sh) | ||
< | <syntaxhighlight lang="bash"> | ||
# If an include wasn't specified in the environment, then search for one... | # If an include wasn't specified in the environment, then search for one... | ||
if [ "x$ES_INCLUDE" = "x" ]; then | if [ "x$ES_INCLUDE" = "x" ]; then | ||
| Line 95: | Line 95: | ||
. "$ES_INCLUDE" | . "$ES_INCLUDE" | ||
fi | fi | ||
</ | </syntaxhighlight> | ||
| Line 111: | Line 111: | ||
==Elasticsearch for QualityBox== | ==Elasticsearch for QualityBox== | ||
< | <syntaxhighlight lang="haproxy"> | ||
# disallow PUT and DELETE methods through the web | # disallow PUT and DELETE methods through the web | ||
# administrators will need to use local curl commands to bypass the load-balancer | # administrators will need to use local curl commands to bypass the load-balancer | ||
| Line 131: | Line 131: | ||
server es1 127.0.0.1:9200 weight 1 check inter 1000 rise 5 fall 1 | server es1 127.0.0.1:9200 weight 1 check inter 1000 rise 5 fall 1 | ||
</ | </syntaxhighlight> | ||
You can add multi-wiki search like so using [https://github.com/wikimedia/mediawiki-extensions-CirrusSearch/blob/master/CirrusSearch.php $wgCirrusSearchEnableCrossProjectSearch], $wgCirrusSearchWikiToNameMap and $wgCirrusSearchInterwikiSources: | You can add multi-wiki search like so using [https://github.com/wikimedia/mediawiki-extensions-CirrusSearch/blob/master/CirrusSearch.php $wgCirrusSearchEnableCrossProjectSearch], $wgCirrusSearchWikiToNameMap and $wgCirrusSearchInterwikiSources: | ||
| Line 138: | Line 138: | ||
< | <syntaxhighlight lang="php"> | ||
if ( $wikiId !== 'commons' ) { | if ( $wikiId !== 'commons' ) { | ||
$wgCirrusSearchEnableCrossProjectSearch = true; | $wgCirrusSearchEnableCrossProjectSearch = true; | ||
| Line 150: | Line 150: | ||
</ | </syntaxhighlight> | ||
==Where is my Elasticsearch?== | ==Where is my Elasticsearch?== | ||
Maybe you installed elasticsearch, but have no idea where it resides on your system. Try this: | Maybe you installed elasticsearch, but have no idea where it resides on your system. Try this: | ||
< | <syntaxhighlight lang="bash"> | ||
curl -XGET "http://localhost:9200/_nodes/settings?pretty=true" | curl -XGET "http://localhost:9200/_nodes/settings?pretty=true" | ||
</ | </syntaxhighlight> | ||
Other direct commands | Other direct commands | ||
< | <syntaxhighlight lang="bash"> | ||
curl 'localhost:9200/_tasks?pretty' | curl 'localhost:9200/_tasks?pretty' | ||
curl 'localhost:9200/_cat/nodes?pretty' | curl 'localhost:9200/_cat/nodes?pretty' | ||
| Line 168: | Line 168: | ||
curl 'localhost:9200/_cat/indices?v' | curl 'localhost:9200/_cat/indices?v' | ||
</ | </syntaxhighlight> | ||
The configuration for Elasticsearch is normally held in two files: <code>/etc/elasticsearch/elasticsearch.yml</code> and <code>/etc/elasticsearch/logging.yml</code> | The configuration for Elasticsearch is normally held in two files: <code>/etc/elasticsearch/elasticsearch.yml</code> and <code>/etc/elasticsearch/logging.yml</code> | ||
| Line 248: | Line 248: | ||
==Installation== | ==Installation== | ||
Here's a quick example of how we got all the parts installed on an [[Ubuntu]] server. | Here's a quick example of how we got all the parts installed on an [[Ubuntu]] server. | ||
< | <syntaxhighlight lang="bash"> | ||
# is the curl extension to PHP installed? | # is the curl extension to PHP installed? | ||
php -i |grep -C2 curl | php -i |grep -C2 curl | ||
| Line 286: | Line 286: | ||
sudo -u www-data php /var/www/freephile.com/www/w/extensions/CirrusSearch/maintenance/forceSearchIndex.php --skipLinks --indexOnSkip | sudo -u www-data php /var/www/freephile.com/www/w/extensions/CirrusSearch/maintenance/forceSearchIndex.php --skipLinks --indexOnSkip | ||
sudo -u www-data php /var/www/freephile.com/www/w/extensions/CirrusSearch/maintenance/forceSearchIndex.php --skipParse | sudo -u www-data php /var/www/freephile.com/www/w/extensions/CirrusSearch/maintenance/forceSearchIndex.php --skipParse | ||
</ | </syntaxhighlight> | ||
Checking if elasticsearch is running | Checking if elasticsearch is running | ||
< | <syntaxhighlight lang="bash"> | ||
curl http://localhost:9200/ | curl http://localhost:9200/ | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang="javascript"> | ||
{ | { | ||
"name" : "Carmella Unuscione", | "name" : "Carmella Unuscione", | ||
| Line 319: | Line 319: | ||
"tagline" : "You Know, for Search" | "tagline" : "You Know, for Search" | ||
} | } | ||
</ | </syntaxhighlight> | ||
==Resources== | ==Resources== | ||
| Line 356: | Line 356: | ||
===SOLVED=== | ===SOLVED=== | ||
You can delete the unwanted index like this with [[curl]]: | You can delete the unwanted index like this with [[curl]]: | ||
< | <syntaxhighlight lang="bash"> | ||
curl -XDELETE "http://localhost:9200/wiki_cod_content" | curl -XDELETE "http://localhost:9200/wiki_cod_content" | ||
</ | </syntaxhighlight> | ||
See more about deleting wikis and all indexes at https://github.com/freephile/meza/blob/6658c795a4b5e5b1a5afcb05c62cf0bcc2d0203b/src/scripts/delete.wikis.sh | See more about deleting wikis and all indexes at https://github.com/freephile/meza/blob/6658c795a4b5e5b1a5afcb05c62cf0bcc2d0203b/src/scripts/delete.wikis.sh | ||