Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
a2aa4ff8
Commit
a2aa4ff8
authored
Nov 25, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup Command interface, alpha ready
parent
40fc84b3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
15 deletions
+68
-15
Command.php
extensions/elasticsearch/Command.php
+67
-14
Connection.php
extensions/elasticsearch/Connection.php
+1
-1
No files found.
extensions/elasticsearch/Command.php
View file @
a2aa4ff8
...
@@ -103,7 +103,7 @@ class Command extends Component
...
@@ -103,7 +103,7 @@ class Command extends Component
* TODO allow specifying type and index + fields
* TODO allow specifying type and index + fields
* @param $index
* @param $index
* @param $type
* @param $type
* @param $id
* @param $id
s
* @param array $options
* @param array $options
* @return mixed
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-multi-get.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-multi-get.html
...
@@ -163,15 +163,19 @@ class Command extends Component
...
@@ -163,15 +163,19 @@ class Command extends Component
* @return mixed
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-update.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-update.html
*/
*/
public
function
update
(
$index
,
$type
,
$id
,
$data
,
$options
=
[])
//
public function update($index, $type, $id, $data, $options = [])
{
//
{
// TODO
// // TODO implement
// return $this->db->delete([$index, $type, $id], $options);
//
//
return $this->db->delete([$index, $type, $id], $options);
}
//
}
// TODO bulk http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html
// TODO bulk http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-bulk.html
/**
/**
* creates an index
* @param $index
* @param array $configuration
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
*/
*/
public
function
createIndex
(
$index
,
$configuration
=
null
)
public
function
createIndex
(
$index
,
$configuration
=
null
)
...
@@ -181,6 +185,9 @@ class Command extends Component
...
@@ -181,6 +185,9 @@ class Command extends Component
}
}
/**
/**
* deletes an index
* @param $index
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-delete-index.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-delete-index.html
*/
*/
public
function
deleteIndex
(
$index
)
public
function
deleteIndex
(
$index
)
...
@@ -189,6 +196,8 @@ class Command extends Component
...
@@ -189,6 +196,8 @@ class Command extends Component
}
}
/**
/**
* deletes all indexes
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-delete-index.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-delete-index.html
*/
*/
public
function
deleteAllIndexes
()
public
function
deleteAllIndexes
()
...
@@ -197,6 +206,9 @@ class Command extends Component
...
@@ -197,6 +206,9 @@ class Command extends Component
}
}
/**
/**
* checks whether an index exists
* @param $index
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-exists.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-exists.html
*/
*/
public
function
indexExists
(
$index
)
public
function
indexExists
(
$index
)
...
@@ -205,6 +217,9 @@ class Command extends Component
...
@@ -205,6 +217,9 @@ class Command extends Component
}
}
/**
/**
* @param $index
* @param $type
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-types-exists.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-types-exists.html
*/
*/
public
function
typeExists
(
$index
,
$type
)
public
function
typeExists
(
$index
,
$type
)
...
@@ -220,6 +235,8 @@ class Command extends Component
...
@@ -220,6 +235,8 @@ class Command extends Component
// TODO http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-warmers.html
// TODO http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-warmers.html
/**
/**
* @param $index
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html
*/
*/
public
function
openIndex
(
$index
)
public
function
openIndex
(
$index
)
...
@@ -228,6 +245,8 @@ class Command extends Component
...
@@ -228,6 +245,8 @@ class Command extends Component
}
}
/**
/**
* @param $index
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-open-close.html
*/
*/
public
function
closeIndex
(
$index
)
public
function
closeIndex
(
$index
)
...
@@ -236,6 +255,8 @@ class Command extends Component
...
@@ -236,6 +255,8 @@ class Command extends Component
}
}
/**
/**
* @param $index
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-status.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-status.html
*/
*/
public
function
getIndexStatus
(
$index
=
'_all'
)
public
function
getIndexStatus
(
$index
=
'_all'
)
...
@@ -247,6 +268,8 @@ class Command extends Component
...
@@ -247,6 +268,8 @@ class Command extends Component
// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-segments.html
// http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-segments.html
/**
/**
* @param $index
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-clearcache.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-clearcache.html
*/
*/
public
function
clearIndexCache
(
$index
)
public
function
clearIndexCache
(
$index
)
...
@@ -255,6 +278,8 @@ class Command extends Component
...
@@ -255,6 +278,8 @@ class Command extends Component
}
}
/**
/**
* @param $index
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-flush.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-flush.html
*/
*/
public
function
flushIndex
(
$index
=
'_all'
)
public
function
flushIndex
(
$index
=
'_all'
)
...
@@ -263,6 +288,8 @@ class Command extends Component
...
@@ -263,6 +288,8 @@ class Command extends Component
}
}
/**
/**
* @param $index
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-refresh.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-refresh.html
*/
*/
public
function
refreshIndex
(
$index
)
public
function
refreshIndex
(
$index
)
...
@@ -275,7 +302,11 @@ class Command extends Component
...
@@ -275,7 +302,11 @@ class Command extends Component
// TODO http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-gateway-snapshot.html
// TODO http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-gateway-snapshot.html
/**
/**
* http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-put-mapping.html
* @param $index
* @param $type
* @param $mapping
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-put-mapping.html
*/
*/
public
function
setMapping
(
$index
,
$type
,
$mapping
)
public
function
setMapping
(
$index
,
$type
,
$mapping
)
{
{
...
@@ -284,7 +315,10 @@ class Command extends Component
...
@@ -284,7 +315,10 @@ class Command extends Component
}
}
/**
/**
* http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-mapping.html
* @param string $index
* @param string $type
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-mapping.html
*/
*/
public
function
getMapping
(
$index
=
'_all'
,
$type
=
'_all'
)
public
function
getMapping
(
$index
=
'_all'
,
$type
=
'_all'
)
{
{
...
@@ -292,7 +326,10 @@ class Command extends Component
...
@@ -292,7 +326,10 @@ class Command extends Component
}
}
/**
/**
* http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-put-mapping.html
* @param $index
* @param $type
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-put-mapping.html
*/
*/
public
function
deleteMapping
(
$index
,
$type
)
public
function
deleteMapping
(
$index
,
$type
)
{
{
...
@@ -300,6 +337,9 @@ class Command extends Component
...
@@ -300,6 +337,9 @@ class Command extends Component
}
}
/**
/**
* @param $index
* @param string $type
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-get-field-mapping.html
*/
*/
public
function
getFieldMapping
(
$index
,
$type
=
'_all'
)
public
function
getFieldMapping
(
$index
,
$type
=
'_all'
)
...
@@ -308,15 +348,24 @@ class Command extends Component
...
@@ -308,15 +348,24 @@ class Command extends Component
}
}
/**
/**
* @param $options
* @param $index
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-analyze.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-analyze.html
*/
*/
public
function
analyze
(
$options
,
$index
=
null
)
//
public function analyze($options, $index = null)
{
//
{
// TODO implement
//
// TODO implement
// return $this->db->put([$index]);
//
//
return $this->db->put([$index]);
}
//
}
/**
/**
* @param $name
* @param $pattern
* @param $settings
* @param $mappings
* @param int $order
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html
*/
*/
public
function
createTemplate
(
$name
,
$pattern
,
$settings
,
$mappings
,
$order
=
0
)
public
function
createTemplate
(
$name
,
$pattern
,
$settings
,
$mappings
,
$order
=
0
)
...
@@ -332,6 +381,8 @@ class Command extends Component
...
@@ -332,6 +381,8 @@ class Command extends Component
}
}
/**
/**
* @param $name
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html
*/
*/
public
function
deleteTemplate
(
$name
)
public
function
deleteTemplate
(
$name
)
...
@@ -341,6 +392,8 @@ class Command extends Component
...
@@ -341,6 +392,8 @@ class Command extends Component
}
}
/**
/**
* @param $name
* @return mixed
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html
*/
*/
public
function
getTemplate
(
$name
)
public
function
getTemplate
(
$name
)
...
...
extensions/elasticsearch/Connection.php
View file @
a2aa4ff8
...
@@ -107,7 +107,7 @@ abstract class Connection extends Component
...
@@ -107,7 +107,7 @@ abstract class Connection extends Component
/**
/**
* select active node randomly
* select active node randomly
*/
*/
p
ublic
function
selectActiveNode
()
p
rotected
function
selectActiveNode
()
{
{
$keys
=
array_keys
(
$this
->
nodes
);
$keys
=
array_keys
(
$this
->
nodes
);
$this
->
activeNode
=
$keys
[
rand
(
0
,
count
(
$keys
)
-
1
)];
$this
->
activeNode
=
$keys
[
rand
(
0
,
count
(
$keys
)
-
1
)];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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