定制 olvlvl/elasticsearch-dsl 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

olvlvl/elasticsearch-dsl

Composer 安装命令:

composer require olvlvl/elasticsearch-dsl

包简介

An objective query builder for Elasticsearch

README 文档

README

Release Build Status Code Quality Code Coverage Packagist

The olvlvl/elasticsearch-dsl package provides an objective query builder for Elasticsearch. It helps you create Elasticsearch queries using the same language as you would use writing arrays by hand.

I created this library because I found using ongr-io/ElasticsearchDSL, the only other available option, very cumbersome, and I wanted an interface that would feel more natural regarding Elasticsearch language.

I've been working on this library since January, it's far from being feature complete, but I'm getting there :) If you'd like to help please submit a PR.

A simple example

Here is a simple example, take from Elasticsearch documentation. More are available in our documentation.

{
    "query": {
        "bool": {
            "must": [
                { "match": { "title": "Search" } },
                { "match": { "content": "Elasticsearch" } }
            ],
            "filter": [
                { "term": { "status": "published" } },
                { "range": { "publish_date": { "gte": "2015-01-01" } } }
            ]
        }
    }
}
<?php

use olvlvl\ElasticsearchDSL\Query;

$query = new Query;
$query->bool->must
    ->match('title', "Search")
    ->match('content', "Elasticsearch");
$query->bool->filter
    ->term('status', 'published')
    ->range('publish_date', function (Query\Term\RangeQuery $range) {
    	$range->gte("2015-01-01");
    });

See more examples

Requirements

The package requires PHP 7.1 or later.

Installation

The recommended way to install this package is through Composer:

$ composer require olvlvl/elasticsearch-dsl

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:

$ git clone https://github.com/olvlvl/elasticsearch-dsl.git

Documentation

You can generate the documentation for the package and its dependencies with the make doc command. The documentation is generated in the build/docs directory. ApiGen is required. The directory can later be cleaned with the make clean command.

Testing

The test suite is ran with the make test command. PHPUnit and Composer need to be globally available to run the suite. The command installs dependencies as required. The make test-coverage command runs test suite and also creates an HTML coverage report in build/coverage. The directory can later be cleaned with the make clean command.

The package is continuously tested by Travis CI.

Build Status Code Coverage

License

olvlvl/elasticsearch-dsl is licensed under the New BSD License - See the LICENSE file for details.

统计信息

  • 总下载量: 4.22k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2018-01-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固