Skip to content

Commit dfe06cc

Browse files
committed
Merge pull request #839 from ruflin/release-2.0.0
Release 2.0.0
2 parents 96e87c8 + d4fa023 commit dfe06cc

File tree

4 files changed

+10
-115
lines changed

4 files changed

+10
-115
lines changed

changes.txt

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
CHANGES
22

33
2015-05-11
4+
- Release 2.0.0
45
- Update elasticsearch dependency to elasticsearch 1.5.2 https://www.elastic.co/downloads/past-releases/elasticsearch-1-5-2 #834
56
- Add testing on PHP 7 on Travis #826
67

7-
2015-05-06
8-
- Add Elastica\Util::copy function by scan and bulk way http://www.elastic.co/guide/en/elasticsearch/guide/master/reindex.html. Note: This was first called reindex #829 #931 ##836
9-
108
2015-04-23
119
- Allow bool in Query::setSource function #818 http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html
1210
- Fix empty bool query to act as match all query #817
@@ -18,22 +16,22 @@ CHANGES
1816
- Add MLT query against documents #814
1917

2018
2015-04-09
21-
- Added Elastica\Query\SimpleQueryString::setMinimumShouldMatch
22-
- Added Elastica\Query\FunctionScore::setMinScore
23-
- Added Elastica\Query\MoreLikeThis::setMinimumShouldMatch
19+
- Added Elastica\Query\SimpleQueryString::setMinimumShouldMatch #813
20+
- Added Elastica\Query\FunctionScore::setMinScore #813
21+
- Added Elastica\Query\MoreLikeThis::setMinimumShouldMatch #813
2422

2523
2015-04-08
26-
- Added new methods to Elastica\Aggregation\DateHistogram: setOffset, setTimezone
27-
- Following methods in Elastica\Aggregation\DateHistogram marked as deprecated: setPreOffset, setPostOffset, setPreZone, setPostZone, setPreZoneAdjustLargeInterval
24+
- Added new methods to Elastica\Aggregation\DateHistogram: setOffset, setTimezone #813
25+
- Following methods in Elastica\Aggregation\DateHistogram marked as deprecated: setPreOffset, setPostOffset, setPreZone, setPostZone, setPreZoneAdjustLargeInterval #813
2826
- Add Elastica\Facet\DateHistogram::setFactor() #806
2927

3028
2015-04-07
31-
- [BC break] Elastica\Query\QueryString::setLowercaseExpandedTerms removed
32-
- Added Elastica\Query\QueryString::setTimezone
29+
- [BC break] Elastica\Query\QueryString::setLowercaseExpandedTerms removed #813
30+
- Added Elastica\Query\QueryString::setTimezone #813
3331

3432
2015-04-06
3533
- Update Elasticsearch version to 1.5 #813
36-
- Added deprecation notice to Elastica\Transport\Thrift, Elastica\Transport\Memcached and Elastica\Type::deleteByQuery
34+
- Added deprecation notice to Elastica\Transport\Thrift, Elastica\Transport\Memcached and Elastica\Type::deleteByQuery #813
3735

3836
2015-04-03
3937
- Add .editorconfig #807

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
},
3535
"extra": {
3636
"branch-alias": {
37-
"dev-master": "1.4.x-dev"
37+
"dev-master": "2.0.x-dev"
3838
}
3939
}
4040
}

lib/Elastica/Util.php

-36
Original file line numberDiff line numberDiff line change
@@ -186,40 +186,4 @@ public static function convertRequestToCurlCommand(Request $request)
186186

187187
return $message;
188188
}
189-
190-
/**
191-
* Copy all data from and old index to a new index
192-
*
193-
* @param \Elastica\Index $oldIndex
194-
* @param \Elastica\Index $newIndex
195-
* @param string $expiryTime
196-
* @param int $sizePerShard
197-
* @return \Elastica\Index The new index object
198-
*/
199-
public static function copy(Index $oldIndex, Index $newIndex, $expiryTime = '1m', $sizePerShard = 1000)
200-
{
201-
$search = new Search($oldIndex->getClient());
202-
$bulk = new Bulk($newIndex->getClient());
203-
$bulk->setIndex($newIndex);
204-
205-
$search->addIndex($oldIndex);
206-
$search->setOption(Search::OPTION_SEARCH_TYPE, Search::OPTION_SEARCH_TYPE_SCAN);
207-
$scanAndScroll = new ScanAndScroll($search, $expiryTime, $sizePerShard);
208-
209-
foreach ($scanAndScroll as $resultSet) {
210-
$data = $resultSet->getResponse()->getData();
211-
$actions = array();
212-
foreach ($data['hits']['hits'] as $d) {
213-
$meta = array('_index' => $newIndex->getName() , '_type' => $d['_type'], '_id' => $d['_id']);
214-
$actions[] = new Action(Action::OP_TYPE_INDEX, $meta ,$d['_source']);
215-
}
216-
//$actions = new Bulk\Action();
217-
$bulk->addActions($actions);
218-
$bulk->send();
219-
}
220-
221-
$newIndex->refresh();
222-
223-
return $newIndex;
224-
}
225189
}

test/lib/Elastica/Test/UtilTest.php

-67
Original file line numberDiff line numberDiff line change
@@ -118,71 +118,4 @@ public function testConvertDateTimeObjectWithoutTimezone()
118118

119119
$this->assertEquals($convertedString, $date);
120120
}
121-
122-
public function testCopy()
123-
{
124-
$client = $this->_getClient();
125-
$oldIndex = $client->getIndex("elastica_test_reindex");
126-
$oldIndex->create(array(
127-
'number_of_shards' => 4,
128-
'number_of_replicas' => 1,
129-
),true);
130-
131-
$newIndex = $client->getIndex("elastica_test_reindex_v2");
132-
$newIndex->create(array(
133-
'number_of_shards' => 4,
134-
'number_of_replicas' => 1,
135-
),true);
136-
137-
$type1 = $oldIndex->getType("test1");
138-
$type2 = $oldIndex->getType("test2");
139-
140-
$documents1[] = $type1->createDocument(1, array('name' => 'Xwei1'));
141-
$documents1[] = $type1->createDocument(2, array('name' => 'Xwei2'));
142-
$documents1[] = $type1->createDocument(3, array('name' => 'Xwei3'));
143-
$documents1[] = $type1->createDocument(4, array('name' => 'Xwei4'));
144-
145-
$documents2[] = $type2->createDocument(1, array('name' => 'Xwei5'));
146-
$documents2[] = $type2->createDocument(2, array('name' => 'Xwei6'));
147-
$documents2[] = $type2->createDocument(3, array('name' => 'Xwei7'));
148-
$documents2[] = $type2->createDocument(4, array('name' => 'Xwei8'));
149-
150-
$type1->addDocuments($documents1);
151-
$type2->addDocuments($documents2);
152-
153-
$oldIndex->refresh();
154-
155-
156-
$this->assertInstanceOf('Elastica\Index', Util::copy($oldIndex, $newIndex,"1m",1));
157-
158-
$newCount = $newIndex->count();
159-
$this->assertEquals(8, $newCount);
160-
}
161-
162-
public function testCopyFail()
163-
{
164-
$client = $this->_getClient();
165-
166-
$oldIndex = $client->getIndex("elastica_test_reindex");
167-
$oldIndex->create(array(
168-
'number_of_shards' => 4,
169-
'number_of_replicas' => 1,
170-
), true);
171-
172-
$newIndex = $client->getIndex("elastica_test_reindex_v2");
173-
$newIndex->create(array(
174-
'number_of_shards' => 4,
175-
'number_of_replicas' => 1,
176-
), true);
177-
178-
$newIndex2 = $client->getIndex("elastica_test_reindex_v2");
179-
$newIndex2->delete();
180-
181-
try {
182-
Util::copy($oldIndex, $newIndex);
183-
$this->fail('New Index should not exist');
184-
} catch (ResponseException $e) {
185-
$this->assertContains('IndexMissingException', $e->getMessage());
186-
}
187-
}
188121
}

0 commit comments

Comments
 (0)