Extension talk:Elastica

Jump to navigation Jump to search

About this board

PHP 7.2+ requires upgrade to ruflin/elastica 5.3.2 to avoid deprecated call to each()

Chiefgeek157 (talkcontribs)

As of the release fo Elastica for MediaWiki 1.31.1, composer.json requires ruflin/elastica 5.3.0. However, that release uses a deprecated call to each(), which PHP 7.2+ catches. ruflin/elastica 5.3.2 has been released which replaces the deprecated call with other logic.

I have locally edited the composer.json file for this extension to update to elastica-5.3.2, and the problem goes away. i recommend all releases of Extension:Elastica which are supported on versions of MediaWiki which support PHP 7.2+ be updated to use ruflin/elastica-5.3.2 or better in composer.json.

Hcpag (talkcontribs)

Hi, When i using ruflin/elastica 5.3.0 return this error:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /var/www/html/extensions/Elastica/vendor/ruflin/elastica/lib/Elastica/Multi/MultiBuilder.php on line 50

Call Stack

# Time Memory Function Location

1 0.0002 399928 {main}( ) .../index.php:0

2 0.0837 3865912 MediaWiki->run( ) .../index.php:42

3 0.3998 6809384 MediaWiki->doPostOutputShutdown( ) .../MediaWiki.php:557

4 0.3998 6812368 MediaWiki->{closure:/var/www/html/includes/MediaWiki.php:725-732}( ) .../MediaWiki.php:750

5 0.3998 6812368 MediaWiki->restInPeace( ) .../MediaWiki.php:727

6 0.4017 6815648 MediaWiki->triggerJobs( ) .../MediaWiki.php:912

7 0.4019 6817736 MediaWiki->triggerSyncJobs( ) .../MediaWiki.php:988

8 0.4020 6819544 JobRunner->run( ) .../MediaWiki.php:1002

9 0.4136 6926440 JobRunner->executeJob( ) .../JobRunner.php:193

10 0.4138 6926728 CirrusSearch\Job\LinksUpdate->run( ) .../JobRunner.php:296

11 0.4138 6926776 CirrusSearch\Job\LinksUpdate->doJob( ) .../Job.php:99

12 0.4139 6930856 CirrusSearch\Updater->updateFromTitle( ) .../LinksUpdate.php:52

13 0.4228 7108040 CirrusSearch\Updater->updatePages( ) .../Updater.php:83

14 0.4232 7116608 CirrusSearch\Updater->buildDocumentsForPages( ) .../Updater.php:205

15 1.0124 9260872 Hooks::run( ) .../Updater.php:424

16 1.0125 9260872 Hooks::callHook( ) .../Hooks.php:205

17 1.0125 9261648 CirrusSearch\BuildDocument\RedirectsAndIncomingLinks::finishBatch( ) .../Hooks.php:177

18 1.0125 9261760 CirrusSearch\BuildDocument\RedirectsAndIncomingLinks->realFinishBatch( ) .../RedirectsAndIncomingLinks.php:93

19 1.0126 9266168 Elastica\Multi\Search->search( ) .../RedirectsAndIncomingLinks.php:157

20 1.0241 9282720 Elastica\Multi\MultiBuilder->buildMultiResultSet( ) .../Search.php:152

21 1.0241 9282720 Elastica\Multi\MultiBuilder->buildResultSets( ) .../MultiBuilder.php:17

22 1.0241 9283120 each ( ) .../MultiBuilder.php:50

I update to 5.3.2, now search dont return results, nothing.


MediaWiki 1.31.1

PHP 7.2.10-0ubuntu0.18.04.1 (apache2handler)

MariaDB 10.1.34-MariaDB-0ubuntu0.18.04.1

ICU 60.2

Elasticsearch 5.6.3

Lua 5.1.5

Elasticsearch is running ok, extensions Elastica (9fcf88c) 08:09 11 oct 2018 and CirrusSearch 0.2 (4330942) 21:17 16 oct 2018

curl -s localhost:9200


  "name" : "HHS_8mf",

  "cluster_name" : "docker-cluster",

  "cluster_uuid" : "phiq1MvXRPaSSK5O46vnkQ",

  "version" : {

    "number" : "5.6.3",

    "build_hash" : "1a2f265",

    "build_date" : "2017-10-06T20:33:39.012Z",

    "build_snapshot" : false,

    "lucene_version" : "6.6.1"


  "tagline" : "You Know, for Search"


Spiros71 (talkcontribs)

I have the same "deprecated call "error, does updating ruflin/elastica to 5.3.2 require reindexing? How exactly is that done?

Reply to "PHP 7.2+ requires upgrade to ruflin/elastica 5.3.2 to avoid deprecated call to each()" (talkcontribs)

How can I install this without composer, I am thinking that is my problem. I tried manually adding the lib folder to the extension directory, but this doesn't seem to fix it. I am on MediaWiki Version 1.31, with the latest Elastica. Here is my backtrace when trying to access Version special page:

[XAg4JO4UlqXF1vZqMIvoVAAAAAY] /index.php/Special:Version Error from line 87 of /opt/mediawiki/extensions/Elastica/includes/ElasticaConnection.php: Class 'Elastica\Client' not found


#0 /opt/mediawiki/extensions/Elastica/includes/ElasticaConnection.php(59): ElasticaConnection->getClient()

#1 /opt/mediawiki/extensions/CirrusSearch/includes/Connection.php(129): ElasticaConnection->setConnectTimeout(integer)

#2 /opt/mediawiki/extensions/CirrusSearch/includes/Hooks.php(698): CirrusSearch\Connection->__construct(CirrusSearch\SearchConfig)

#3 /opt/mediawiki/extensions/CirrusSearch/includes/Hooks.php(409): CirrusSearch\Hooks::getConnection()

#4 /opt/mediawiki/includes/Hooks.php(177): CirrusSearch\Hooks::onSoftwareInfo(array)

#5 /opt/mediawiki/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)

#6 /opt/mediawiki/includes/specials/SpecialVersion.php(241): Hooks::run(string, array)

#7 /opt/mediawiki/includes/specials/SpecialVersion.php(139): SpecialVersion::softwareInformation()

#8 /opt/mediawiki/includes/specialpage/SpecialPage.php(522): SpecialVersion->execute(NULL)

#9 /opt/mediawiki/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL)

#10 /opt/mediawiki/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)

#11 /opt/mediawiki/includes/MediaWiki.php(861): MediaWiki->performRequest()

#12 /opt/mediawiki/includes/MediaWiki.php(524): MediaWiki->main()

#13 /opt/mediawiki/index.php(42): MediaWiki->run()

#14 {main}

Reply to "Installing without composer"

Call to undefined method Elastica\Query::setStoredFields

Legaulph (talkcontribs)

Initial indexing went without issue. When I search my wiki I get this error:

[W60b6u7GOm7aJbK@gnZVwAAAAAA] /index.php?title=Special%3ASearch&search=PM&go=Go Error from line 57 of /app/mediawiki/extensions/CirrusSearch/includes/Search/SearchRequestBuilder.php: Call to undefined method Elastica\Query::setStoredFields()


#0 /app/mediawiki/extensions/CirrusSearch/includes/Searcher.php(453): CirrusSearch\Search\SearchRequestBuilder->build()
#1 /app/mediawiki/extensions/CirrusSearch/includes/Searcher.php(461): CirrusSearch\Searcher->buildSearch()
#2 /app/mediawiki/extensions/CirrusSearch/includes/Searcher.php(199): CirrusSearch\Searcher->searchOne()
#3 /app/mediawiki/extensions/CirrusSearch/includes/Hooks.php(542): CirrusSearch\Searcher->nearMatchTitleSearch(string)
#4 /app/mediawiki/includes/Hooks.php(177): CirrusSearch\Hooks::onSearchGetNearMatch(string, NULL)
#5 /app/mediawiki/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#6 /app/mediawiki/includes/search/SearchNearMatcher.php(123): Hooks::run(string, array)
#7 /app/mediawiki/includes/search/SearchNearMatcher.php(32): SearchNearMatcher->getNearMatchInternal(string)
#8 /app/mediawiki/includes/specials/SpecialSearch.php(253): SearchNearMatcher->getNearMatch(string)
#9 /app/mediawiki/includes/specials/SpecialSearch.php(143): SpecialSearch->goResult(string)
#10 /app/mediawiki/includes/specialpage/SpecialPage.php(522): SpecialSearch->execute(NULL)
#11 /app/mediawiki/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL)
#12 /app/mediawiki/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#13 /app/mediawiki/includes/MediaWiki.php(861): MediaWiki->performRequest()
#14 /app/mediawiki/includes/MediaWiki.php(524): MediaWiki->main()
#15 /app/mediawiki/index.php(42): MediaWiki->run()
#16 {main}
MediaWiki	1.31.0
PHP	7.1.8 (apache2handler)
MySQL	5.6.10
ICU	50.1.2
Elasticsearch	5.3.0
Elastica (0959e38) 20:02, 24 October 2016
CirrusSearch	0.2 (c23ae6a) 17:21, 25 October 2016
Loman87 (talkcontribs)

Hi, I am getting the same error with the following configuration

Product Version
MediaWiki 1.31.1
PHP 7.0.25-0ubuntu0.16.04.1 (apache2handler)
MySQL 5.7.21-0ubuntu0.16.04.1
ICU 55.1
Elasticsearch 5.6.1
Lua 5.1.5

any ideas?

Loman87 (talkcontribs)

Hi, I solved uninstalling elastic search, Elastica and CirrusSearch extensions and then following the instructions from the beginning. Everything works now. I guess it could be an issue after upgrading from 1.27.4 to 1.31.1 where another version of elasticsearch is used.

Reply to "Call to undefined method Elastica\Query::setStoredFields"

Elastica not communicating with ES?

RodolfoEBDR (talkcontribs)

How can I debug the query from a search, to see if the client or the server or the query itself is not sending/receiving the right data? Everything in my setup seems right, but still no results at ANY search query are being received. I'm desperate. The issue comes from here: Topic:Uhko5f4mgr1nn3pt

Any tip will be thank.

Reply to "Elastica not communicating with ES?"

Composer Needed with require_once syntax?

Johnywhy (talkcontribs)

If i use older require_once syntax, do i still need Composer?

Reply to "Composer Needed with require_once syntax?"
Johnywhy (talkcontribs)

According to my shell client, the install "failed with error". But the terminal output looks ok. Does it look like this install failed?

Loading composer repositories with package information
Updating dependencies
Package operations: 2 installs, 0 updates, 0 removals
  - Installing elasticsearch/elasticsearch (5.3.0): Downloading (connecting...)Downloading (0%)           Downloading (5%)Downloading (10%)Downloading (15%)Downloading (20%)Downloading (25%)Downloading (30%)Downloading (35%)Downloading (40%)Downloading (45%)Downloading (50%)Downloading (55%)Downloading (60%)Downloading (65%)Downloading (70%)Downloading (75%)Downloading (80%)Downloading (85%)Downloading (90%)Downloading (95%)Downloading (100%)
  - Installing ruflin/elastica (5.3.0): Downloading (connecting...)Downloading (100%)         
Writing lock file
Generating autoload files
Screenshot (306)
Reply to "Composer Install Failed?"

Class 'Elastica\Transport\Http' not found

2 (talkcontribs)

Followig the steps here for MW1.30, I get the following error:

PHP Fatal error:  Class 'Elastica\Transport\Http' not found in /var/www/extensions/Elastica/ElasticaConnection.php on line 207 (talkcontribs)

Resolution for information:

I must restart apache2, after that it is working.

Reply to "Class 'Elastica\Transport\Http' not found"

Class 'Elastica\Transport\Http' not found

CalNation (talkcontribs)

Followig the steps here for MW1.28, I get the following error:

PHP Fatal error:  Class 'Elastica\Transport\Http' not found in /var/www/extensions/Elastica/ElasticaConnection.php on line 207

PHP Stack trace:

PHP   1. {main}() /var/www/extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php:0

PHP   2. require_once() /var/www/extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php:65

PHP   3. CirrusSearch\Maintenance\UpdateSearchIndexConfig->execute() /var/www/maintenance/doMaintenance.php:111

PHP   4. CirrusSearch\Maintenance\Maintenance->getConnection() /var/www/extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php:54

PHP   5. spl_autoload_call() /var/www/extensions/CirrusSearch/includes/Maintenance/Maintenance.php:108

PHP   6. AutoLoader::autoload() /var/www/extensions/CirrusSearch/includes/Maintenance/Maintenance.php:108

PHP   7. require() /var/www/includes/AutoLoader.php:81

PHP   8. spl_autoload_call() /var/www/extensions/CirrusSearch/includes/Connection.php:29

Can anyone help please?

Sk4p (talkcontribs)

The page says PHP 5.3+ works, yet when I run composer I get:

Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
 Problem 1
   - Installation request for satooshi/php-coveralls dev-master -> satisfiable by satooshi/php-coveralls[dev-master].
   - satooshi/php-coveralls dev-master requires php ^5.5 || ^7.0 -> your PHP version (5.4.16) does not satisfy that requirement.

... so "5.3+" is not accurate?

Mainframe98 (talkcontribs)

Which version of MediaWiki are you running? And more important, which version (REL1_2X) of the extension do you use, newer releases require newer versions of PHP.

Reply to "PHP version insufficient?"

Unexpected Elasticsearch failure?

AmazingTrans (talkcontribs)

I had just get Elastica from extension:elastica site, and cirrussearch from Extension:CirrusSearch.

I'm assuming i have ElasticSearch since the following is stated in my version:

Therefore, i set the following from

$wgCirrusSearchServers = array( 'elasticsearch0', 'elasticsearch1', 'elasticsearch2', 'elasticsearch3' );


$wgCirrusSearchServers = "localhost''

There are other $wgCirrusSearch variables that you might want to change from their defaults.

Now run this script to generate your elasticsearch index:

 php $MW_INSTALL_PATH/extensions/CirrusSearch/maintenance/updateSearchIndexConfig.php

 Once i run the updateSearchIndexConfig script, the following error shows:

content index...
Fetching Elasticsearch version...
Unexpected Elasticsearch failure.
Http error communicating with Elasticsearch: Couldn't connect to host, Elastic search down?

ANy idea what would cause this or how do i enable elasticsearch?

AmazingTrans (talkcontribs)

installed elasticsearch and works. (talkcontribs)

Hey how did you solve the problem -

Http error communicating with Elasticsearch: Couldn't connect to host, Elastic search down?

AmazingTrans (talkcontribs)

I think i got electricsearch working, but cirrus didn't work and i quit pursuing it.

Anybody has any luck? would be great if someone can post about it.

Reply to "Unexpected Elasticsearch failure?"