Changes

Jump to navigation Jump to search
3,903 bytes added ,  12:16, 18 May 2020
add notes
This site uses Elasticsearch for it's search functionality under the hood.
{{Feature
|explainsimage= Search|description= This site uses Elasticsearch for the best possible search experience [[File:System-searchElasticsearch_logo.svg|linkimgdesc=Search|thumb|128px]]|notes=|tests=Search for something in "files" which indicates that PDF index results are returned instead of just articles. E.g. [https://wiki.freephile.org/w/index.php?title=Special:Search&profile=advanced&profile=advanced&fulltext=Search&search=ssh-agent&ns6=1 Search for 'ssh-agent' in the File namespace]|examples=
}}
{{#set:feature description = This site uses Elasticsearch for an amazing search experience! }}
{{#set:feature notes = [https://medium.com/@AIMDekTech/what-is-elasticsearch-why-elasticsearch-advantages-of-elasticsearch-47b81b549f4d The What, Why and Advantages of Elasticsearch] }}
{{#set:feature tests = Search for something in "files" which indicates that PDF index results are returned instead of just articles. E.g.[https://wiki.freephile.org/wiki/index.php?title=Special:Search&profile=advanced&profile=advanced&fulltext=Search&search=ssh-agent&ns6=1 Search for 'ssh-agent' in the File namespace] }}
{{#set:feature examples = }}
This site uses Elasticsearch for it's search functionality under the hood.
 
=== Search Tips ===
This wiki supports Elasticsearch features. So, for example, let's say you want to search for 'Ansible' in the wiki, but you know that there is an Ansible page, and you don't want to be taken directly to that page. Instead, you prefer to actually see all the [Special:Search search results for 'Ansible']. Just prefix your search term with the <code>~</code> character. Now when you press enter, you'll go to the search results page with a full listing of results. Use the <code>morelike:</code> special prefix [https://wiki.freephile.org/wiki/api.php?action=query&list=search&srsearch=morelike:Elasticsearch morelike:Elasticsearch]  Use the <code>cirrusdump</code> action to see the document as ElasticSearch sees it [{{fullurl:{{PAGENAMEE}}|action=cirrusdump}}]. This is especially useful to test whether (new) documents are being indexed. Additional MediaWiki API methods like <code>cirrus-config-dump</code> are listed at [[mw:Extension:CirrusSearch#API]]
{{Messagebox
{{Messagebox
| type = success
| text = Content as well as all files uploaded into the system are indexed. For example, [{{fullurl:Special:Search|search=fai|fulltext=Search|profile=all}} a search for "FAI"] lists both the [[Cloning]] article as well as the [[:File:Fai poster a4.pdf|PDF file]] And the file is not listed only because of the file name, but also because of the (indexed) file content. [{{fullurl:S pecialSpecial:Search|search=ed%20roman|fulltext=Search|profile=all}} A search for "Ed Roman"] will bring up the Enterprise Java Beans Design Patterns PDF file ([{{fullurl:File:Ejbdesignpatterns.pdf|page=13}} see p. 13 where Ed Roman is mentioned].)
}}
--prop val set elasticsearch property (i.e. -Des.<prop>=<val>)
</pre>
 
For version 1.7 on Ubuntu 16.04, although the system uses SystemD, there is still a SysV init script that controls elasticsearch. I think this means that you can't get the logging info into the journalctl system... See /etc/init.d/elasticsearch According to the [https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html install guide], you should be able to edit the elasticsearch.service file, and take out the --quiet option to make it log to the journal. When that is enabled, you can do <code>journalctl --unit elasticsearch</code> to quickly see the info being logged.
== Production Configuration ==
; CirrusSearch : CirrusSearch is a MediaWiki extension that provides search support backed by Elasticsearch.
; Elasticsearch : is a Java application, so you need [[Java]] installed as well. As all these pieces continue to be developed and released, you must be sure to take heed of the requirements for matching the right versions together to compose your full setup.
 
== Elasticsearch for QualityBox ==
 
<source lang="haproxy">
# disallow PUT and DELETE methods through the web
# administrators will need to use local curl commands to bypass the load-balancer
# in the event that you want to delete indexes etc.
frontend elastic
bind *:9201
mode http
acl is_delete method DELETE
http-request deny if is_delete
acl is_put method PUT
http-request deny if is_put
default_backend elastic
backend elastic
mode http
option forwardfor
balance source
option httpclose
server es1 127.0.0.1:9200 weight 1 check inter 1000 rise 5 fall 1
 
</source>
 
You can add multi-wiki search like so using [https://github.com/wikimedia/mediawiki-extensions-CirrusSearch/blob/master/CirrusSearch.php $wgCirrusSearchEnableCrossProjectSearch], $wgCirrusSearchWikiToNameMap and $wgCirrusSearchInterwikiSources:
 
 
 
 
<source lang="php">
if ( $wikiId !== 'commons' ) {
$wgCirrusSearchEnableCrossProjectSearch = true;
$wgCirrusSearchWikiToNameMap = [
'commons' => 'wiki_commons',
];
$wgCirrusSearchInterwikiSources = [
'commons' => 'wiki_commons_content_first',
];
}
 
 
</source>
== Where is my Elasticsearch? ==
curl 'localhost:9200/_cluster/health?pretty=true'
curl 'localhost:9200/_cluster/state?pretty'
 
curl 'localhost:9200/_cat/indices?v'
</source>
If you are re-indexing your existing Meza installation, you can <code> sudo meza maint rebuild monolith --tags search-index</code>
 
 
== Monitoring ==
With the upgrade to Elasticsearch 5.x and 6.x, plugins are deprecated. It's suggested to use Kibana as a monitoring and management interface to Elasticsearch.
<img src="http://meta.qualitybox.us:20000/api/v1/badge.svg?chart=elasticsearch_local.cluster_health_status&alarm=elasticsearch_last_collected&refresh=auto" />
 
http://meta.qualitybox.us:20000/api/v1/badge.svg?chart=elasticsearch_local.cluster_health_status&alarm=elasticsearch_last_collected&refresh=auto" type="image/svg+xml
 
 
<html>
<embed src="http://meta.qualitybox.us:20000/api/v1/badge.svg?chart=elasticsearch_local.cluster_health_status&alarm=elasticsearch_last_collected&refresh=auto" type="image/svg+xml" height="20"/>
</html>
 
* Monitoring the Elastic Stack https://www.elastic.co/guide/en/elastic-stack-overview/6.4/xpack-monitoring.html
* Monitoring Settings https://www.elastic.co/guide/en/elasticsearch/reference/6.4/monitoring-settings.html
* X-Pack monitoring https://www.elastic.co/guide/en/kibana/current/xpack-monitoring.html
* Configuring Monitoring in Kibana https://www.elastic.co/guide/en/kibana/6.4/monitoring-xpack-kibana.html
* Monitoring with [https://github.com/lmenezes/cerebro Cerebro]
* You can still use [https://mobz.github.io/elasticsearch-head/ elasticsearch-head] if you use an SSH reverse tunnel to access the remote server.
 
 
== Installation ==

Navigation menu