Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
8e87e895
Commit
8e87e895
authored
Jun 09, 2015
by
Robert Lyon
Committed by
Gerrit Code Review
Jun 09, 2015
Browse files
Merge "elasticsearch: Add index name to _bulk command path"
parents
dbdeb077
278889b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/elastica/README.Mahara
View file @
8e87e895
...
@@ -8,4 +8,6 @@ This library is used for for interfacing with an elasticsearch server.
...
@@ -8,4 +8,6 @@ This library is used for for interfacing with an elasticsearch server.
Changes:
Changes:
* Removed build & test files not needed for Mahara.
* Removed build & test files not needed for Mahara.
\ No newline at end of file
* Added an option to do include the Elasticsearch Index in the URL for bulk addDocument calls
\ No newline at end of file
htdocs/lib/elastica/lib/Elastica/Client.php
View file @
8e87e895
...
@@ -291,15 +291,19 @@ class Client
...
@@ -291,15 +291,19 @@ class Client
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
* @link http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
*
*
* @param array|\Elastica\Document[] $docs Array of Elastica\Document
* @param array|\Elastica\Document[] $docs Array of Elastica\Document
* @param string|\Elastica\Index (Optional) If all of the documents are for the same index
* @return \Elastica\Bulk\ResponseSet Response object
* @return \Elastica\Bulk\ResponseSet Response object
*/
*/
public
function
addDocuments
(
array
$docs
)
public
function
addDocuments
(
array
$docs
,
Index
$index
=
null
)
{
{
if
(
empty
(
$docs
))
{
if
(
empty
(
$docs
))
{
throw
new
InvalidException
(
'Array has to consist of at least one element'
);
throw
new
InvalidException
(
'Array has to consist of at least one element'
);
}
}
$bulk
=
new
Bulk
(
$this
);
$bulk
=
new
Bulk
(
$this
);
if
(
$index
)
{
$bulk
->
setIndex
(
$index
);
}
$bulk
->
addDocuments
(
$docs
);
$bulk
->
addDocuments
(
$docs
);
...
...
htdocs/lib/elastica/lib/Elastica/Index.php
View file @
8e87e895
...
@@ -145,7 +145,7 @@ class Index implements SearchableInterface
...
@@ -145,7 +145,7 @@ class Index implements SearchableInterface
$doc
->
setIndex
(
$this
->
getName
());
$doc
->
setIndex
(
$this
->
getName
());
}
}
return
$this
->
getClient
()
->
addDocuments
(
$docs
);
return
$this
->
getClient
()
->
addDocuments
(
$docs
,
$this
);
}
}
/**
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment