coldtrick/elasticsearch
最新稳定版本:v7.0.1
Composer 安装命令:
composer require coldtrick/elasticsearch
包简介
An Elasticsearch implementation for Elgg
README 文档
README
An Elasticsearch implementation for Elgg
Requirements
A working ElasticSearch server is required. Also the minute cron has to be working on your Elgg installation. The minute cron is used to update the index with all the required changes (create/update/delete).
The current supported version of ElasticSearch is: 7.4.x
Configuration
Settings
The plugin settings allow you to configure the following:
- Hosts: 1 or more hosts need to be configured (full URL + optional portnumber). You can provide more hosts comma seperated.
- Index: Name of the index used for indexing Elgg data and search queries
- Search alias (optional): Name of the alias to use in search queries, this allows for easy searching across multiple indices
Index Management
The index management page (found under Administer -> ElasticSearch -> Indices in the admin sidebar) allows you to perform various actions on all the indexes available on the ElastisSearch server. The following actions are supported:
- Create: This action can only be performed if the index configured in the plugin settings page is not yet available. It will create the default index configuration to be used for search.
- Alias: Add/remove the configured alias to the index (this allows searching across multiple indices)
- Delete: This will remove the index from the server (this action can not be undone)
Administration
Log files
Based on the log level of your Elgg site, there will also be logging of the ElasticSearch PHP client library. Logging will appear in the same location as all other Elgg logs.
Statistics
You can find various statistics on the Administer -> ElasticSearch -> Statistics page. Elgg statistics report on the amount of entities found in the Elgg database that should be in the index. It also reports on the amount of entities that need to be added/updated/deleted in the index and that are currently waiting on the minute cron to process them.
Also some statistics from the Elastic Cluster are shown like the status and the version information.
You can also find statistics for all available indexes on this page.
CLI commands
CLI commands are available to be used with the default elgg-cli command
elasticsearch:sync
This command will synchronize all pending entities to the Elasticsearch index. This is especialy usefull during the reindexing process of the database because a lot of entities need to be indexed. Using the normal cron task in this case could take a long time.
Recommendations
Use the Search Advanced plugin to add extra features to search. If both are enabled this plugin provides a menu to sort/order the results.
Developers
Plugin hooks
'boostable_types', 'elasticsearch'
Return an array of type.subtype to be used for configuaring boosting in Elasticsearch.
In the format:
[
'type.subtype',
]
Defaults to the registered searchable type/subtypes for Elasticsearch.
'config:index', 'elasticsearch'
Return an array with the index configuration to be used by Elasticsearch.
'config:mapping', 'elasticsearch'
Return an array with the mapping configuration to be used by Elasticsearch.
'export:counters', 'elasticsearch'
Return an array of counters to be exported to Elasticsearch.
In the format:
[
'counter_name' => counter_value
]
Params contain:
entity: theElggEntitybeing exported
'export:metadata_names', 'elasticsearch'
Return an array of metadata names to be exported to Elasticsearch.
Params contain:
entity: theElggEntitybeing exported
'index_entity_type_subtypes', 'elasticsearch'
Return an array of type/subtypes allowed to be indexed by Elasticsearch.
In the format:
[ 'type' => ['subtype1', 'subtype2'], ]
Defaults to all registered searchable type/subtypes in Elgg.
'index:entity:prevent', 'elasticsearch'
Return true if the provided entity shouldn't be added to the Elasticsearch index
Params contain:
entity: theElggEntityabout to be indexed
Default: false
'index:entity:type', 'elasticsearch'
Return a string under which type/subtype the entity should be indexed. This is used for type filtering during the search (eg. all blogs)
Params contain:
entity: theElggEntityabout to be indexeddefault: the default type/subtype for this entity
Default: {entity_type}.{entity_subtype} (eg. object.blog)
'params', 'elasticsearch'
Return an array of parameters to be using in initializing the \ColdTrick\ElasticSearch\Client Elasticsearch client.
'search', 'type_subtype_pairs'
Return an array of type/subtypes allowed to be searched by Elasticsearch.
In the format:
[ 'type' => ['subtype1', 'subtype2'], ]
Defaults to all registered searchable type/subtypes in Elgg.
'search_params', 'elasticsearch'
Return an \ColdTrick\ElasticSearch\Di\SearchService to be used for the search. This allows you to alter the search parameters
in Elasticsearch.
Params contain:
search_params: an array of the search parameters as provided by Elgg search
'to:entity:before', 'elasticsearch'
Change the Elasticsearch hit data before it's converted to an ElggEntity
Params contain:
hit: the result from Elasticsearchsearch_params: an array of the search parameters as provided by Elgg search
'to:entity', 'elasticsearch'
Return an ElggEntity based on the search result data from Elasticsearch.
Params contain:
hit: the result from Elasticsearchsearch_params: an array of the search parameters as provided by Elgg search
Parameters passed to elgg_search
field_boosting
In the parameters passed to elgg_search you can add a configuration to control field boosting in Elasticsearch. Add the key
field_boosting to the array which holds an array with fieldname and the boosting for that field.
Example:
[ 'field_boosting' => [ 'title' => 2, // title is worth double 'description' => 0.5 // description is worth half ], ]
coldtrick/elasticsearch 适用场景与选型建议
coldtrick/elasticsearch 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.84k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2015 年 07 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「search」 「lucene」 「elasticsearch」 「elgg」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 coldtrick/elasticsearch 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coldtrick/elasticsearch 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 coldtrick/elasticsearch 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
a general purpose text search engine written entirely in PHP 5
Pimcore 5.x Website Indexer (powered by Zend Search Lucene)
A Laravel package to retrieve data from Google Search Console
Laravel 5.5 package for full-text search over Eloquent models based on ZendSearch Lucene.
统计信息
- 总下载量: 1.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-only
- 更新时间: 2015-07-30