Skip to content

Commit

Permalink
Merge pull request #4 from othillo/elasticsearch-php-5
Browse files Browse the repository at this point in the history
support Elasticsearch 5
  • Loading branch information
asm89 authored Mar 7, 2017
2 parents 0eccae3 + e55698c commit a5a548d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
15 changes: 9 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@ language: php

sudo: true

addons:
apt:
packages:
- oracle-java8-set-default

matrix:
fast_finish: true
include:
- php: 5.6
- php: 7.0
- php: 7.1
env: ES_VERSION="2.4.4"
- php: 7.1
env: ES_VERSION="1.7.6" DOWNLOAD_URL="https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-${ES_VERSION}.deb"
- php: hhvm
allow_failures:
- php: hhvm

env:
global:
- ES_VERSION="2.4.4"
- DOWNLOAD_URL="https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/${ES_VERSION}/elasticsearch-${ES_VERSION}.deb"
- ES_VERSION="5.2.2"

before_install:
- curl -O $DOWNLOAD_URL && sudo dpkg -i --force-confnew elasticsearch-${ES_VERSION}.deb && sudo service elasticsearch restart
- curl -O "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.deb"
- sudo dpkg -i --force-confnew elasticsearch-${ES_VERSION}.deb
- sudo service elasticsearch restart
- phpenv config-rm xdebug.ini || return 0
- echo "memory_limit=2G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini || return 0

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# Changelog

## 0.2.x

#### BC breaks

- Dropped support for Elasticsearch 1 and 2
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ using [elastic/elasticsearch-php](https://github.com/elastic/elasticsearch-php)
$ composer require broadway/read-model-elasticsearch
```

## Version Matrix

| Elasticsearch Version | broadway/read-model-elasticsearch version |
| --------------------- | ----------------------------------------- |
| >= 5.0 | 0.2 |
| >= 1.0, < 5.0 | 0.1 |

- If you are using Elasticsearch 5.0+ , use broadway/read-model-elasticsearch 0.2.
- If you are using Elasticsearch 1.x or 2.x, use broadway/read-model-elasticsearch 0.1.


## License

MIT, see LICENSE.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"description": "Elasticsearch read model implementation using elastic/elasticsearch-php",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"php": "^5.6|^7.0",
"broadway/broadway": "^1.0",
"elasticsearch/elasticsearch": "^2.0"
"elasticsearch/elasticsearch": "^5.0"
},
"authors": [
{
Expand Down Expand Up @@ -49,7 +49,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.2.x-dev"
"dev-master": "0.3.x-dev"
}
}
}
9 changes: 3 additions & 6 deletions src/ElasticSearchRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,8 @@ protected function query(array $query)
private function buildFindByQuery(array $fields)
{
return [
'filtered' => [
'query' => [
'match_all' => new \stdClass(),
],
'filter' => $this->buildFilter($fields)
'bool' => [
'must' => $this->buildFilter($fields)
]
];
}
Expand Down Expand Up @@ -219,7 +216,7 @@ private function buildFilter(array $filter)
$retval[] = ['term' => [$field => $value]];
}

return ['and' => $retval];
return $retval;
}

/**
Expand Down

0 comments on commit a5a548d

Please sign in to comment.