_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q19900 | Aggregation.avg_bucket | train | public function avg_bucket(string $name, string $bucketsPath = | php | {
"resource": ""
} |
q19901 | Aggregation.percentiles | train | public function percentiles(string $name, string $field = | php | {
"resource": ""
} |
q19902 | Aggregation.scripted_metric | train | public function scripted_metric(
string $name,
string $initScript = null,
string $mapScript = null,
string $combineScript = null,
string $reduceScript = null
| php | {
"resource": ""
} |
q19903 | Aggregation.filter | train | public function filter(string $name, AbstractQuery $filter = | php | {
"resource": ""
} |
q19904 | Aggregation.reverse_nested | train | public function reverse_nested(string $name, string $path = | php | {
"resource": ""
} |
q19905 | Aggregation.histogram | train | public function histogram(string $name, string $field, $interval): Histogram | php | {
"resource": ""
} |
q19906 | Aggregation.date_histogram | train | public function date_histogram(string $name, string $field, $interval): DateHistogram | php | {
"resource": ""
} |
q19907 | Aggregation.geo_distance | train | public function geo_distance(string $name, string $field, $origin): GeoDistance | php | {
"resource": ""
} |
q19908 | Aggregation.bucket_script | train | public function bucket_script(string $name, array $bucketsPath = null, string $script | php | {
"resource": ""
} |
q19909 | Aggregation.serial_diff | train | public function serial_diff(string $name, string $bucketsPath = | php | {
"resource": ""
} |
q19910 | MoreLikeThis.setAnalyzer | train | public function setAnalyzer(string $analyzer): self
{
| php | {
"resource": ""
} |
q19911 | Http._setupCurl | train | protected function _setupCurl($curlConnection)
{
if ($this->getConnection()->hasConfig('curl')) {
foreach ($this->getConnection()->getConfig('curl') as $key => $param) {
| php | {
"resource": ""
} |
q19912 | Http._getConnection | train | protected function _getConnection(bool $persistent = true)
{
if (!$persistent || !self::$_curlConnection) | php | {
"resource": ""
} |
q19913 | Task.refresh | train | public function refresh(array $options = [])
{
$endpoint = new \Elasticsearch\Endpoints\Tasks\Get();
$endpoint->setTaskId($this->_id);
$endpoint->setParams($options);
| php | {
"resource": ""
} |
q19914 | ElasticsearchException._parseError | train | protected function _parseError(string $error)
{
$errors = \explode(']; nested: ', $error);
if (1 === \count($errors)) {
$this->_exception = $this->_extractException($errors[0]);
} else {
if (self::REMOTE_TRANSPORT_EXCEPTION === $this->_extractException($errors[0])) {... | php | {
"resource": ""
} |
q19915 | IndexTemplate.request | train | public function request($method, $data = [])
{
$path = '_template/'.$this->getName();
| php | {
"resource": ""
} |
q19916 | Snapshot.registerRepository | train | public function registerRepository($name, $type, $settings = [])
{
$data = [
| php | {
"resource": ""
} |
q19917 | Snapshot.getRepository | train | public function getRepository($name)
{
try {
$response = $this->request($name);
} catch (ResponseException $e) {
if (404 == $e->getResponse()->getStatus()) {
| php | {
"resource": ""
} |
q19918 | Snapshot.createSnapshot | train | public function createSnapshot($repository, $name, $options = [], $waitForCompletion = false)
| php | {
"resource": ""
} |
q19919 | Snapshot.getSnapshot | train | public function getSnapshot($repository, $name)
{
try {
$response = $this->request($repository.'/'.$name);
} catch (ResponseException $e) {
if (404 == $e->getResponse()->getStatus()) {
| php | {
"resource": ""
} |
q19920 | Snapshot.restoreSnapshot | train | public function restoreSnapshot($repository, $name, $options = [], $waitForCompletion = false)
{
$endpoint = new Restore();
$endpoint->setRepository($repository);
$endpoint->setSnapshot($name);
$endpoint->setBody($options); | php | {
"resource": ""
} |
q19921 | Snapshot.request | train | public function request($path, $method = Request::GET, $data = [], array $query | php | {
"resource": ""
} |
q19922 | Settings.getPersistent | train | public function getPersistent(string $setting = '')
{
$data = $this->get();
$settings = $data['persistent'];
if ('' !== $setting) {
| php | {
"resource": ""
} |
q19923 | Settings.getTransient | train | public function getTransient(string $setting = '')
{
$data = $this->get();
$settings = $data['transient'];
if ('' !== $setting) {
if (isset($settings[$setting])) {
return $settings[$setting];
}
if (false !== \strpos($setting, '.')) {
... | php | {
"resource": ""
} |
q19924 | Settings.setReadOnly | train | public function setReadOnly(bool $readOnly = true, bool $persistent = false): Response
{
$key = 'cluster.blocks.read_only';
if ($persistent) {
| php | {
"resource": ""
} |
q19925 | Settings.request | train | public function request(array $data = [], string $method = Request::GET): Response
{
$path = '_cluster/settings';
| php | {
"resource": ""
} |
q19926 | Cluster.getNodeNames | train | public function getNodeNames()
{
$data = $this->getState();
$nodeNames = [];
foreach ($data['nodes'] as $node) {
| php | {
"resource": ""
} |
q19927 | Cluster.getNodes | train | public function getNodes()
{
$nodes = [];
$data = $this->getState();
foreach ($data['nodes'] as $id => $name) {
| php | {
"resource": ""
} |
q19928 | Request.send | train | public function send()
{
$transport = $this->getConnection()->getTransportObject();
// Refactor: Not full toArray needed in exec?
| php | {
"resource": ""
} |
q19929 | InnerHits.addScriptField | train | public function addScriptField(string $name, AbstractScript $script): self
{
if (!isset($this->_params['script_fields'])) {
| php | {
"resource": ""
} |
q19930 | Client.getVersion | train | public function getVersion()
{
if ($this->_version) {
return $this->_version;
}
| php | {
"resource": ""
} |
q19931 | Client._initConnections | train | protected function _initConnections()
{
$connections = [];
foreach ($this->getConfig('connections') as $connection) {
$connections[] = Connection::create($this->_prepareConnectionParams($connection));
}
if (isset($this->_config['servers'])) {
foreach ($this-... | php | {
"resource": ""
} |
q19932 | Client._prepareConnectionParams | train | protected function _prepareConnectionParams(array $config)
{
$params = [];
$params['config'] = [];
foreach ($config as $key => $value) {
if (\in_array($key, ['bigintConversion', 'curl', 'headers', 'url'])) {
$params['config'][$key] = | php | {
"resource": ""
} |
q19933 | Client.addHeader | train | public function addHeader($header, $headerValue)
{
if (\is_string($header) && \is_string($headerValue)) {
| php | {
"resource": ""
} |
q19934 | Client.removeHeader | train | public function removeHeader($header)
{
if (\is_string($header)) {
if (\array_key_exists($header, $this->_config['headers'])) {
unset($this->_config['headers'][$header]);
}
| php | {
"resource": ""
} |
q19935 | Client.deleteIds | train | public function deleteIds(array $ids, $index, $type, $routing = false)
{
if (empty($ids)) {
throw new InvalidException('Array has to consist of at least one id');
}
$bulk = new Bulk($this);
$bulk->setIndex($index);
$bulk->setType($type);
foreach ($ids as... | php | {
"resource": ""
} |
q19936 | Client.bulk | train | public function bulk(array $params)
{
if (empty($params)) {
throw new InvalidException('Array has to consist of at least one param');
}
| php | {
"resource": ""
} |
q19937 | Client.request | train | public function request($path, $method = Request::GET, $data = [], array $query = [], $contentType = Request::DEFAULT_CONTENT_TYPE)
{
$connection = $this->getConnection();
$request = $this->_lastRequest = new Request($path, $method, $data, $query, $connection, $contentType);
$this->_lastResp... | php | {
"resource": ""
} |
q19938 | Client.requestEndpoint | train | public function requestEndpoint(AbstractEndpoint $endpoint)
{
return $this->request(
\ltrim($endpoint->getURI(), '/'),
$endpoint->getMethod(),
| php | {
"resource": ""
} |
q19939 | Client.forcemergeAll | train | public function forcemergeAll($args = [])
{
$endpoint = new ForceMerge();
| php | {
"resource": ""
} |
q19940 | AbstractUpdateAction.setType | train | public function setType($type)
{
if ($type instanceof Type) {
$this->setIndex($type->getIndex());
| php | {
"resource": ""
} |
q19941 | AbstractUpdateAction.setIndex | train | public function setIndex($index)
{
if ($index instanceof Index) {
$index = $index->getName();
| php | {
"resource": ""
} |
q19942 | AbstractTransport.sanityzeQueryStringBool | train | public function sanityzeQueryStringBool(array $query)
{
foreach ($query as $key => $value) {
| php | {
"resource": ""
} |
q19943 | AbstractTransport.create | train | public static function create($transport, Connection $connection, array $params = []): AbstractTransport
{
if (\is_array($transport) && isset($transport['type'])) {
$transportParams = $transport;
unset($transportParams['type']);
$params = \array_replace($params, $transpo... | php | {
"resource": ""
} |
q19944 | Guzzle._getGuzzleClient | train | protected function _getGuzzleClient(bool $persistent = true): Client
{
if (!$persistent || !self::$_guzzleClientConnection) { | php | {
"resource": ""
} |
q19945 | Guzzle._getBaseUrl | train | protected function _getBaseUrl(Connection $connection): string
{
// If url is set, url is taken. Otherwise port, host and path
$url = $connection->hasConfig('url') ? $connection->getConfig('url') : '';
if (!empty($url)) {
$baseUri = $url;
} else {
$baseUri = ... | php | {
"resource": ""
} |
q19946 | Guzzle._getActionPath | train | protected function _getActionPath(Request $request): string
{
$action = $request->getPath();
if ($action) {
$action = '/'.\ltrim($action, '/');
}
if (!Util::isDateMathEscaped($action)) {
$action = Util::escapeDateMath($action);
}
$query = | php | {
"resource": ""
} |
q19947 | Match.setFieldParam | train | public function setFieldParam(string $field, string $key, string $value): self
{
if (!isset($this->_params[$field])) {
$this->_params[$field] = [];
| php | {
"resource": ""
} |
q19948 | Match.setFieldOperator | train | public function setFieldOperator(string $field, string $operator = self::OPERATOR_OR): self | php | {
"resource": ""
} |
q19949 | Match.setFieldAnalyzer | train | public function setFieldAnalyzer(string $field, string $analyzer): self | php | {
"resource": ""
} |
q19950 | Match.setFieldBoost | train | public function setFieldBoost(string $field, float $boost = | php | {
"resource": ""
} |
q19951 | Match.setFieldFuzzyRewrite | train | public function setFieldFuzzyRewrite(string $field, string $fuzzyRewrite): self | php | {
"resource": ""
} |
q19952 | Match.setFieldPrefixLength | train | public function setFieldPrefixLength(string $field, int $prefixLength): self | php | {
"resource": ""
} |
q19953 | Match.setFieldMaxExpansions | train | public function setFieldMaxExpansions(string $field, int $maxExpansions): self | php | {
"resource": ""
} |
q19954 | Match.setFieldZeroTermsQuery | train | public function setFieldZeroTermsQuery(string $field, string $zeroTermQuery = self::ZERO_TERM_NONE): self | php | {
"resource": ""
} |
q19955 | Match.setFieldCutoffFrequency | train | public function setFieldCutoffFrequency(string $field, float $cutoffFrequency): self | php | {
"resource": ""
} |
q19956 | Bulk.setRequestParam | train | public function setRequestParam(string $name, $value): self
{
| php | {
"resource": ""
} |
q19957 | AbstractDocument.create | train | public static function create($data, string $opType = null): self
{
//Check type
if (!$data instanceof Document && !$data instanceof AbstractScript) {
throw new \InvalidArgumentException('The data needs to be a Document or a Script.');
}
if (null === $opType && $data->ha... | php | {
"resource": ""
} |
q19958 | Info.get | train | public function get()
{
$data = $this->getData();
foreach (\func_get_args() as $arg) {
if (isset($data[$arg])) {
$data = $data[$arg];
| php | {
"resource": ""
} |
q19959 | Info.getPort | train | public function getPort(): string
{
// Returns string in format: inet[/192.168.1.115:9201]
| php | {
"resource": ""
} |
q19960 | Info.getIp | train | public function getIp(): string
{
// Returns string in format: inet[/192.168.1.115:9201]
| php | {
"resource": ""
} |
q19961 | Info.getPlugins | train | public function getPlugins(): array
{
if (!\in_array('plugins', $this->_params, true)) {
//Plugin data was not retrieved when refresh() was called last. Get it now.
| php | {
"resource": ""
} |
q19962 | Info.hasPlugin | train | public function hasPlugin($name): bool
{
foreach ($this->getPlugins() as $plugin) {
| php | {
"resource": ""
} |
q19963 | Node.getName | train | public function getName()
{
if (empty($this->_name)) {
| php | {
"resource": ""
} |
q19964 | Type.addDocument | train | public function addDocument(Document $doc)
{
$endpoint = new \Elasticsearch\Endpoints\Index();
if (null !== $doc->getId() && '' !== $doc->getId()) {
$endpoint->setID($doc->getId());
}
$options = $doc->getOptions(
[
'version',
... | php | {
"resource": ""
} |
q19965 | Type.getDocument | train | public function getDocument($id, array $options = [])
{
$endpoint = new \Elasticsearch\Endpoints\Get();
$endpoint->setID($id);
$endpoint->setParams($options);
$response = $this->requestEndpoint($endpoint);
$result = $response->getData();
if (!isset($result['found'])... | php | {
"resource": ""
} |
q19966 | Type.setMapping | train | public function setMapping($mapping, array $query = [])
{
$mapping = Mapping::create($mapping);
| php | {
"resource": ""
} |
q19967 | Type.getMapping | train | public function getMapping()
{
$response = $this->requestEndpoint(new Get());
$data = $response->getData();
$mapping = \array_shift($data);
| php | {
"resource": ""
} |
q19968 | Type.createSearch | train | public function createSearch($query = '', $options = null, BuilderInterface $builder = null)
{
| php | {
"resource": ""
} |
q19969 | Type.search | train | public function search($query = '', $options = null)
{
| php | {
"resource": ""
} |
q19970 | Type.deleteById | train | public function deleteById($id, array $options = [])
{
if (empty($id) || !\trim($id)) {
throw new \InvalidArgumentException();
}
$endpoint = new Delete();
$endpoint->setID($id);
$endpoint->setParams($options);
| php | {
"resource": ""
} |
q19971 | Type.deleteIds | train | public function deleteIds(array $ids, $routing = false)
{
return | php | {
"resource": ""
} |
q19972 | Type.deleteByQuery | train | public function deleteByQuery($query, array $options = [])
{
$query = Query::create($query);
$endpoint = new DeleteByQuery();
$endpoint->setBody($query->toArray());
| php | {
"resource": ""
} |
q19973 | Type.request | train | public function request($path, $method, $data = [], array $query = [])
{
| php | {
"resource": ""
} |
q19974 | Type.requestEndpoint | train | public function requestEndpoint(AbstractEndpoint $endpoint)
{
$cloned = clone $endpoint;
| php | {
"resource": ""
} |
q19975 | Settings.get | train | public function get(string $setting = '')
{
$requestData = $this->request()->getData();
$data = \reset($requestData);
if (empty($data['settings']) || empty($data['settings']['index'])) {
// should not append, the request should throw a ResponseException
throw new Not... | php | {
"resource": ""
} |
q19976 | Settings.getBool | train | public function getBool(string $setting): bool
{
$data = $this->get($setting);
| php | {
"resource": ""
} |
q19977 | Settings.setMergePolicy | train | public function setMergePolicy(string $key, string $value): Response
{
$this->_index->close();
$response | php | {
"resource": ""
} |
q19978 | Settings.request | train | public function request(array $data = [], string $method = Request::GET): Response
{
$path = '_settings';
| php | {
"resource": ""
} |
q19979 | Health._retrieveHealthData | train | protected function _retrieveHealthData(): array
{
$endpoint = new \Elasticsearch\Endpoints\Cluster\Health();
$endpoint->setParams(['level' => 'shards']);
| php | {
"resource": ""
} |
q19980 | Health.getIndices | train | public function getIndices(): array
{
$indices = [];
foreach ($this->_data['indices'] as $indexName => $index) {
$indices[$indexName] | php | {
"resource": ""
} |
q19981 | ResultSet.hasError | train | public function hasError(): bool
{
foreach ($this->getResultSets() as $resultSet) {
if ($resultSet->getResponse()->hasError()) {
| php | {
"resource": ""
} |
q19982 | AbstractSuggest.setName | train | public function setName(string $name): AbstractSuggest
{
if (empty($name)) {
throw new InvalidException('Suggest name has to be set'); | php | {
"resource": ""
} |
q19983 | Fuzzy.setField | train | public function setField(string $fieldName, string $value): self
{
if (!\is_string($value) || !\is_string($fieldName)) {
throw new InvalidException('The field and value arguments must be of type string.');
}
if (\count($this->getParams()) > 0 && \key($this->getParams()) !== $fiel... | php | {
"resource": ""
} |
q19984 | Fuzzy.setFieldOption | train | public function setFieldOption(string $option, $value): self
{
//Retrieve the single existing field for alteration.
$params = $this->getParams();
if (\count($params) < 1) {
throw new InvalidException('No field has been set');
| php | {
"resource": ""
} |
q19985 | Result.getData | train | public function getData()
{
if (isset($this->_hit['fields'])) {
return isset($this->_hit['_source'])
? \array_merge($this->getFields(), | php | {
"resource": ""
} |
q19986 | Result.getDocument | train | public function getDocument()
{
$doc = new Document();
$doc->setData($this->getSource());
$hit = $this->getHit();
unset($hit['_source']);
unset($hit['_explanation']); | php | {
"resource": ""
} |
q19987 | Pipeline.create | train | public function create()
{
if (empty($this->id)) {
throw new InvalidException('You should set a valid pipeline id');
}
if (empty($this->_params['description'])) {
throw new InvalidException('You should set a valid processor description.');
}
if (empt... | php | {
"resource": ""
} |
q19988 | Pipeline.getPipeline | train | public function getPipeline(string $id)
{
$endpoint = new Get();
$endpoint->setID($id);
| php | {
"resource": ""
} |
q19989 | Pipeline.deletePipeline | train | public function deletePipeline(string $id)
{
$endpoint = new | php | {
"resource": ""
} |
q19990 | Pipeline.addProcessor | train | public function addProcessor(AbstractProcessor $processor)
{
if (empty($this->_processors)) {
$this->_processors['processors'] = $processor->toArray();
$this->_params['processors'] = [];
} else {
| php | {
"resource": ""
} |
q19991 | ResponseException.getFailures | train | public function getFailures(): array
{
$errors = [];
foreach ($this->getActionExceptions() as | php | {
"resource": ""
} |
q19992 | DateHistogram.setExtendedBounds | train | public function setExtendedBounds(string $min = '', string $max = ''): self
{
$bounds = [];
$bounds['min'] = $min;
$bounds['max'] = $max;
// switch if min is higher then max
if (\strtotime($min) > \strtotime($max)) {
| php | {
"resource": ""
} |
q19993 | Document.addFile | train | public function addFile($key, $filepath, $mimeType = '')
{
$value = \base64_encode(\file_get_contents($filepath));
if (!empty($mimeType)) {
| php | {
"resource": ""
} |
q19994 | Wildcard.setValue | train | public function setValue(string $key, string $value, float $boost = 1.0): | php | {
"resource": ""
} |
q19995 | SpanFirst._setQuery | train | protected function _setQuery(string $type, $args): self
{
if (!\is_array($args) && !($args instanceof AbstractSpanQuery)) {
throw new InvalidException('Invalid parameter. Has | php | {
"resource": ""
} |
q19996 | Query.create | train | public static function create($query)
{
switch (true) {
case $query instanceof self:
return $query;
case $query instanceof AbstractQuery:
return new self($query);
case empty($query):
return new self(new MatchAll());
... | php | {
"resource": ""
} |
q19997 | Query.setScriptFields | train | public function setScriptFields($scriptFields)
{
if (\is_array($scriptFields)) {
$scriptFields = new ScriptFields($scriptFields);
| php | {
"resource": ""
} |
q19998 | Query.addScriptField | train | public function addScriptField($name, AbstractScript $script)
{
if (isset($this->_params['script_fields'])) {
$this->_params['script_fields']->addScript($name, $script);
| php | {
"resource": ""
} |
q19999 | Query.toArray | train | public function toArray()
{
if (!isset($this->_params['query']) && (0 == $this->_suggest)) {
$this->setQuery(new MatchAll());
}
if (isset($this->_params['post_filter']) && 0 === \count(($this->_params['post_filter'])->toArray())) {
unset($this->_params['post_filter']... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.