mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
elasticsearch phpdoc and command api cleanup
This commit is contained in:
@ -308,10 +308,10 @@ class Command extends Component
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-put-mapping.html
|
* @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, $options = [])
|
||||||
{
|
{
|
||||||
$body = $mapping !== null ? Json::encode($mapping) : null;
|
$body = $mapping !== null ? (is_string($mapping) ? $mapping : Json::encode($mapping)) : null;
|
||||||
return $this->db->put([$index, $type, '_mapping'], $body);
|
return $this->db->put([$index, $type, '_mapping'], $options, $body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -308,7 +308,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param string $type the facet type. e.g. `terms`, `range`, `histogram`...
|
* @param string $type the facet type. e.g. `terms`, `range`, `histogram`...
|
||||||
* @param string|array $options the configuration options for this facet. Can be an array or a json string.
|
* @param string|array $options the configuration options for this facet. Can be an array or a json string.
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-query-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-query-facet.html
|
||||||
*/
|
*/
|
||||||
public function addFacet($name, $type, $options)
|
public function addFacet($name, $type, $options)
|
||||||
@ -321,7 +321,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* The `terms facet` allow to specify field facets that return the N most frequent terms.
|
* The `terms facet` allow to specify field facets that return the N most frequent terms.
|
||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-terms-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-terms-facet.html
|
||||||
*/
|
*/
|
||||||
public function addTermFacet($name, $options)
|
public function addTermFacet($name, $options)
|
||||||
@ -334,7 +334,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* within each range, and aggregated data either based on the field, or using another field.
|
* within each range, and aggregated data either based on the field, or using another field.
|
||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-range-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-range-facet.html
|
||||||
*/
|
*/
|
||||||
public function addRangeFacet($name, $options)
|
public function addRangeFacet($name, $options)
|
||||||
@ -348,7 +348,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* interval/bucket (count and total).
|
* interval/bucket (count and total).
|
||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-histogram-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-histogram-facet.html
|
||||||
*/
|
*/
|
||||||
public function addHistogramFacet($name, $options)
|
public function addHistogramFacet($name, $options)
|
||||||
@ -360,7 +360,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* A specific histogram facet that can work with date field types enhancing it over the regular histogram facet.
|
* A specific histogram facet that can work with date field types enhancing it over the regular histogram facet.
|
||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-date-histogram-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-date-histogram-facet.html
|
||||||
*/
|
*/
|
||||||
public function addDateHistogramFacet($name, $options)
|
public function addDateHistogramFacet($name, $options)
|
||||||
@ -373,7 +373,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* The filter itself can be expressed using the Query DSL.
|
* The filter itself can be expressed using the Query DSL.
|
||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param string $filter the query in Query DSL
|
* @param string $filter the query in Query DSL
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-filter-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-filter-facet.html
|
||||||
*/
|
*/
|
||||||
public function addFilterFacet($name, $filter)
|
public function addFilterFacet($name, $filter)
|
||||||
@ -386,7 +386,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* The query itself can be expressed using the Query DSL.
|
* The query itself can be expressed using the Query DSL.
|
||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param string $query the query in Query DSL
|
* @param string $query the query in Query DSL
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-query-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-query-facet.html
|
||||||
*/
|
*/
|
||||||
public function addQueryFacet($name, $query)
|
public function addQueryFacet($name, $query)
|
||||||
@ -399,7 +399,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* total, sum of squares, mean (average), minimum, maximum, variance, and standard deviation.
|
* total, sum of squares, mean (average), minimum, maximum, variance, and standard deviation.
|
||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-statistical-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-statistical-facet.html
|
||||||
*/
|
*/
|
||||||
public function addStatisticalFacet($name, $options)
|
public function addStatisticalFacet($name, $options)
|
||||||
@ -412,7 +412,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* per term value driven by another field.
|
* per term value driven by another field.
|
||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-terms-stats-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-terms-stats-facet.html
|
||||||
*/
|
*/
|
||||||
public function addTermsStatsFacet($name, $options)
|
public function addTermsStatsFacet($name, $options)
|
||||||
@ -425,7 +425,7 @@ class Query extends Component implements QueryInterface
|
|||||||
* including count of the number of hits that fall within each range, and aggregation information (like `total`).
|
* including count of the number of hits that fall within each range, and aggregation information (like `total`).
|
||||||
* @param string $name the name of this facet
|
* @param string $name the name of this facet
|
||||||
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
* @param array $options additional option. Please refer to the elasticsearch documentation for details.
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-geo-distance-facet.html
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-geo-distance-facet.html
|
||||||
*/
|
*/
|
||||||
public function addGeoDistanceFacet($name, $options)
|
public function addGeoDistanceFacet($name, $options)
|
||||||
@ -442,7 +442,7 @@ class Query extends Component implements QueryInterface
|
|||||||
/**
|
/**
|
||||||
* Sets the querypart of this search query.
|
* Sets the querypart of this search query.
|
||||||
* @param string $query
|
* @param string $query
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
*/
|
*/
|
||||||
public function query($query)
|
public function query($query)
|
||||||
{
|
{
|
||||||
@ -453,7 +453,7 @@ class Query extends Component implements QueryInterface
|
|||||||
/**
|
/**
|
||||||
* Sets the filter part of this search query.
|
* Sets the filter part of this search query.
|
||||||
* @param string $filter
|
* @param string $filter
|
||||||
* @return static
|
* @return static the query object itself
|
||||||
*/
|
*/
|
||||||
public function filter($filter)
|
public function filter($filter)
|
||||||
{
|
{
|
||||||
@ -467,12 +467,14 @@ class Query extends Component implements QueryInterface
|
|||||||
* or a an array of multiple indexes. If this is `null` it means that all indexes are being queried.
|
* or a an array of multiple indexes. If this is `null` it means that all indexes are being queried.
|
||||||
* @param string|array $type The type to retrieve data from. This can be a string representing a single type
|
* @param string|array $type The type to retrieve data from. This can be a string representing a single type
|
||||||
* or a an array of multiple types. If this is `null` it means that all types are being queried.
|
* or a an array of multiple types. If this is `null` it means that all types are being queried.
|
||||||
|
* @return static the query object itself
|
||||||
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-search.html#search-multi-index-type
|
* @see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-search.html#search-multi-index-type
|
||||||
*/
|
*/
|
||||||
public function from($index, $type = null)
|
public function from($index, $type = null)
|
||||||
{
|
{
|
||||||
$this->index = $index;
|
$this->index = $index;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user