Download the PHP package chenyuanqi/elasticsearch without Composer
On this page you can find all versions of the php package chenyuanqi/elasticsearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package elasticsearch
chenyuanqi/elasticsearch not only for laravel5
This package depends on "elasticsearch/elasticsearch" and it provides a unified API across a variety of different full text search services.
Notice: Test for elasticsearch 2.x, even than 5.x; whatever, some function cannot take effect for the low one.
The following dependencies are needed for the listed search drivers:
Structure
├── Commands
│ └── ElasticsearchService.php
├── config
│ └── elasticsearch.php
├── Analyze.php
├── Builder.php
├── Query.php
├── SearchFacade.php
└── SearchServiceProvider.php
Suggestion
For safety reasons, please install the plugin: shield
For search effectively, these plugins may be useful for you:
1、head
2、bigdesk
3、kopt
4、sql
5、ik
6、pinyin
7、同义词
8、简繁转换
Install
You can edit composer.json file, in the require object:
Or use composer command:
After that, run composer update to install this package.
Actually, it was finished but in laravel5 that you still let the service provider to app/config/app.php, within the providers array.
Add a class alias to app/config/app.php, within the aliases array.
Configure
In laravel5, publish the default config file to your application then make modifications as you can.
However, default config file is config/elasticsearch.php.
Laravel Usage
1、search for create index
Notice: Index name must be lowercase.
2、search for mapping due to config
3、search for select index and type
Notice: Here index and type has default value.
4、search for insert data
5、search for update data
Here provide two way for update data,
By the way, use update by query must open the script setting
6、search for increase or decrease data
Like update by query, increase or decrease also open the script setting
7、search for delete data
Here provide two way for delete data,
8、search for clean index
9、search for bulk
Notice: Default handle is 'index'.
10、everything is for search
You can select fields show for search.
Default paging is true and show the result first ten, If you don't need it
Construct the conditions with queryString, just like that
Or the conditions with filter
Or the conditions with ids
Or the conditions with match
Or the conditions with term
Or the conditions with bool
Or the conditions with null
Or the conditions with aggregation
Or the conditions with range
However, the range query has fourth parameter which use as extra action.
Or the conditions with where query
Here are two ways When we need paging.
And count the record, just use the count function.
At last, use the debug function that output the debug message as you need.
Notice: you must output the message after search.
Others Usage
You know, it uses the facade design pattern above all of laravel usage.
So in here, just replace the Search object like that:
All right, Happy hacking~