idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
6,500 | 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 ] ) ) { $ thi... | Parse error message from elasticsearch . |
6,501 | public function request ( $ method , $ data = [ ] ) { $ path = '_template/' . $ this -> getName ( ) ; return $ this -> getClient ( ) -> request ( $ path , $ method , $ data ) ; } | Makes calls to the elasticsearch server based on this index template name . |
6,502 | public function registerRepository ( $ name , $ type , $ settings = [ ] ) { $ data = [ 'type' => $ type , 'settings' => $ settings , ] ; return $ this -> request ( $ name , Request :: PUT , $ data ) ; } | Register a snapshot repository . |
6,503 | public function getRepository ( $ name ) { try { $ response = $ this -> request ( $ name ) ; } catch ( ResponseException $ e ) { if ( 404 == $ e -> getResponse ( ) -> getStatus ( ) ) { throw new NotFoundException ( "Repository '" . $ name . "' does not exist." ) ; } throw $ e ; } $ data = $ response -> getData ( ) ; re... | Retrieve a repository record by name . |
6,504 | public function createSnapshot ( $ repository , $ name , $ options = [ ] , $ waitForCompletion = false ) { return $ this -> request ( $ repository . '/' . $ name , Request :: PUT , $ options , [ 'wait_for_completion' => $ waitForCompletion ] ) ; } | Create a new snapshot . |
6,505 | public function getSnapshot ( $ repository , $ name ) { try { $ response = $ this -> request ( $ repository . '/' . $ name ) ; } catch ( ResponseException $ e ) { if ( 404 == $ e -> getResponse ( ) -> getStatus ( ) ) { throw new NotFoundException ( "Snapshot '" . $ name . "' does not exist in repository '" . $ reposito... | Retrieve data regarding a specific snapshot . |
6,506 | public function restoreSnapshot ( $ repository , $ name , $ options = [ ] , $ waitForCompletion = false ) { $ endpoint = new Restore ( ) ; $ endpoint -> setRepository ( $ repository ) ; $ endpoint -> setSnapshot ( $ name ) ; $ endpoint -> setBody ( $ options ) ; $ endpoint -> setParams ( [ 'wait_for_completion' => $ wa... | Restore a snapshot . |
6,507 | public function request ( $ path , $ method = Request :: GET , $ data = [ ] , array $ query = [ ] ) { return $ this -> _client -> request ( '_snapshot/' . $ path , $ method , $ data , $ query ) ; } | Perform a snapshot request . |
6,508 | public function getPersistent ( string $ setting = '' ) { $ data = $ this -> get ( ) ; $ settings = $ data [ 'persistent' ] ; if ( '' !== $ setting ) { return $ settings [ $ setting ] ?? null ; } return $ settings ; } | Returns the current persistent settings of the cluster . |
6,509 | public function getTransient ( string $ setting = '' ) { $ data = $ this -> get ( ) ; $ settings = $ data [ 'transient' ] ; if ( '' !== $ setting ) { if ( isset ( $ settings [ $ setting ] ) ) { return $ settings [ $ setting ] ; } if ( false !== \ strpos ( $ setting , '.' ) ) { $ keys = \ explode ( '.' , $ setting ) ; f... | Returns the current transient settings of the cluster . |
6,510 | public function setReadOnly ( bool $ readOnly = true , bool $ persistent = false ) : Response { $ key = 'cluster.blocks.read_only' ; if ( $ persistent ) { return $ this -> setPersistent ( $ key , $ readOnly ) ; } return $ this -> setTransient ( $ key , $ readOnly ) ; } | Sets the cluster to read only . |
6,511 | public function request ( array $ data = [ ] , string $ method = Request :: GET ) : Response { $ path = '_cluster/settings' ; return $ this -> getClient ( ) -> request ( $ path , $ method , $ data ) ; } | Sends settings request . |
6,512 | public function getNodeNames ( ) { $ data = $ this -> getState ( ) ; $ nodeNames = [ ] ; foreach ( $ data [ 'nodes' ] as $ node ) { $ nodeNames [ ] = $ node [ 'name' ] ; } return $ nodeNames ; } | Returns a list of existing node names . |
6,513 | public function getNodes ( ) { $ nodes = [ ] ; $ data = $ this -> getState ( ) ; foreach ( $ data [ 'nodes' ] as $ id => $ name ) { $ nodes [ ] = new Node ( $ id , $ this -> getClient ( ) ) ; } return $ nodes ; } | Returns all nodes of the cluster . |
6,514 | public function send ( ) { $ transport = $ this -> getConnection ( ) -> getTransportObject ( ) ; return $ transport -> exec ( $ this , $ this -> getConnection ( ) -> toArray ( ) ) ; } | Sends request to server . |
6,515 | public function addScriptField ( string $ name , AbstractScript $ script ) : self { if ( ! isset ( $ this -> _params [ 'script_fields' ] ) ) { $ this -> _params [ 'script_fields' ] = new ScriptFields ( ) ; } $ this -> _params [ 'script_fields' ] -> addScript ( $ name , $ script ) ; return $ this ; } | Adds a Script to the aggregation . |
6,516 | public function getVersion ( ) { if ( $ this -> _version ) { return $ this -> _version ; } $ data = $ this -> request ( '/' ) -> getData ( ) ; return $ this -> _version = $ data [ 'version' ] [ 'number' ] ; } | Get current version . |
6,517 | protected function _initConnections ( ) { $ connections = [ ] ; foreach ( $ this -> getConfig ( 'connections' ) as $ connection ) { $ connections [ ] = Connection :: create ( $ this -> _prepareConnectionParams ( $ connection ) ) ; } if ( isset ( $ this -> _config [ 'servers' ] ) ) { foreach ( $ this -> getConfig ( 'ser... | Inits the client connections . |
6,518 | protected function _prepareConnectionParams ( array $ config ) { $ params = [ ] ; $ params [ 'config' ] = [ ] ; foreach ( $ config as $ key => $ value ) { if ( \ in_array ( $ key , [ 'bigintConversion' , 'curl' , 'headers' , 'url' ] ) ) { $ params [ 'config' ] [ $ key ] = $ value ; } else { $ params [ $ key ] = $ value... | Creates a Connection params array from a Client or server config array . |
6,519 | public function addHeader ( $ header , $ headerValue ) { if ( \ is_string ( $ header ) && \ is_string ( $ headerValue ) ) { $ this -> _config [ 'headers' ] [ $ header ] = $ headerValue ; } else { throw new InvalidException ( 'Header must be a string' ) ; } return $ this ; } | Adds a HTTP Header . |
6,520 | public function removeHeader ( $ header ) { if ( \ is_string ( $ header ) ) { if ( \ array_key_exists ( $ header , $ this -> _config [ 'headers' ] ) ) { unset ( $ this -> _config [ 'headers' ] [ $ header ] ) ; } } else { throw new InvalidException ( 'Header must be a string' ) ; } return $ this ; } | Remove a HTTP Header . |
6,521 | 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 $ id ) { $ action = n... | Deletes documents with the given ids index type from the index . |
6,522 | public function bulk ( array $ params ) { if ( empty ( $ params ) ) { throw new InvalidException ( 'Array has to consist of at least one param' ) ; } $ bulk = new Bulk ( $ this ) ; $ bulk -> addRawData ( $ params ) ; return $ bulk -> send ( ) ; } | Bulk operation . |
6,523 | 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 ) ; ... | Makes calls to the elasticsearch server based on this index . |
6,524 | public function requestEndpoint ( AbstractEndpoint $ endpoint ) { return $ this -> request ( \ ltrim ( $ endpoint -> getURI ( ) , '/' ) , $ endpoint -> getMethod ( ) , null === $ endpoint -> getBody ( ) ? [ ] : $ endpoint -> getBody ( ) , $ endpoint -> getParams ( ) ) ; } | Makes calls to the elasticsearch server with usage official client Endpoint . |
6,525 | public function forcemergeAll ( $ args = [ ] ) { $ endpoint = new ForceMerge ( ) ; $ endpoint -> setParams ( $ args ) ; return $ this -> requestEndpoint ( $ endpoint ) ; } | Force merges all search indices . |
6,526 | public function setType ( $ type ) { if ( $ type instanceof Type ) { $ this -> setIndex ( $ type -> getIndex ( ) ) ; $ type = $ type -> getName ( ) ; } return $ this -> setParam ( '_type' , $ type ) ; } | Sets the document type name . |
6,527 | public function setIndex ( $ index ) { if ( $ index instanceof Index ) { $ index = $ index -> getName ( ) ; } return $ this -> setParam ( '_index' , $ index ) ; } | Sets the document index name . |
6,528 | public function sanityzeQueryStringBool ( array $ query ) { foreach ( $ query as $ key => $ value ) { if ( \ is_bool ( $ value ) ) { $ query [ $ key ] = ( $ value ) ? 'true' : 'false' ; } } return $ query ; } | BOOL values true|false should be sanityzed and passed to Elasticsearch as string . |
6,529 | 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 , $ transportParam... | Create a transport . |
6,530 | protected function _getGuzzleClient ( bool $ persistent = true ) : Client { if ( ! $ persistent || ! self :: $ _guzzleClientConnection ) { self :: $ _guzzleClientConnection = new Client ( ) ; } return self :: $ _guzzleClientConnection ; } | Return Guzzle resource . |
6,531 | protected function _getBaseUrl ( Connection $ connection ) : string { $ url = $ connection -> hasConfig ( 'url' ) ? $ connection -> getConfig ( 'url' ) : '' ; if ( ! empty ( $ url ) ) { $ baseUri = $ url ; } else { $ baseUri = ( string ) Uri :: fromParts ( [ 'scheme' => $ this -> _scheme , 'host' => $ connection -> get... | Builds the base url for the guzzle connection . |
6,532 | protected function _getActionPath ( Request $ request ) : string { $ action = $ request -> getPath ( ) ; if ( $ action ) { $ action = '/' . \ ltrim ( $ action , '/' ) ; } if ( ! Util :: isDateMathEscaped ( $ action ) ) { $ action = Util :: escapeDateMath ( $ action ) ; } $ query = $ request -> getQuery ( ) ; if ( ! emp... | Builds the action path url for each request . |
6,533 | public function setFieldParam ( string $ field , string $ key , string $ value ) : self { if ( ! isset ( $ this -> _params [ $ field ] ) ) { $ this -> _params [ $ field ] = [ ] ; } $ this -> _params [ $ field ] [ $ key ] = $ value ; return $ this ; } | Sets a param for the given field . |
6,534 | public function setFieldOperator ( string $ field , string $ operator = self :: OPERATOR_OR ) : self { return $ this -> setFieldParam ( $ field , 'operator' , $ operator ) ; } | Set field operator . |
6,535 | public function setFieldAnalyzer ( string $ field , string $ analyzer ) : self { return $ this -> setFieldParam ( $ field , 'analyzer' , $ analyzer ) ; } | Set field analyzer . |
6,536 | public function setFieldBoost ( string $ field , float $ boost = 1.0 ) : self { return $ this -> setFieldParam ( $ field , 'boost' , $ boost ) ; } | Set field boost value . |
6,537 | public function setFieldFuzzyRewrite ( string $ field , string $ fuzzyRewrite ) : self { return $ this -> setFieldParam ( $ field , 'fuzzy_rewrite' , $ fuzzyRewrite ) ; } | Set field fuzzy rewrite . |
6,538 | public function setFieldPrefixLength ( string $ field , int $ prefixLength ) : self { return $ this -> setFieldParam ( $ field , 'prefix_length' , $ prefixLength ) ; } | Set field prefix length . |
6,539 | public function setFieldMaxExpansions ( string $ field , int $ maxExpansions ) : self { return $ this -> setFieldParam ( $ field , 'max_expansions' , $ maxExpansions ) ; } | Set field max expansions . |
6,540 | public function setFieldZeroTermsQuery ( string $ field , string $ zeroTermQuery = self :: ZERO_TERM_NONE ) : self { return $ this -> setFieldParam ( $ field , 'zero_terms_query' , $ zeroTermQuery ) ; } | Set zero terms query . |
6,541 | public function setFieldCutoffFrequency ( string $ field , float $ cutoffFrequency ) : self { return $ this -> setFieldParam ( $ field , 'cutoff_frequency' , $ cutoffFrequency ) ; } | Set cutoff frequency . |
6,542 | public function setRequestParam ( string $ name , $ value ) : self { $ this -> _requestParams [ $ name ] = $ value ; return $ this ; } | Set a url parameter on the request bulk request . |
6,543 | public static function create ( $ data , string $ opType = null ) : self { if ( ! $ data instanceof Document && ! $ data instanceof AbstractScript ) { throw new \ InvalidArgumentException ( 'The data needs to be a Document or a Script.' ) ; } if ( null === $ opType && $ data -> hasOpType ( ) ) { $ opType = $ data -> ge... | Creates a bulk action for a document or a script . |
6,544 | public function get ( ) { $ data = $ this -> getData ( ) ; foreach ( \ func_get_args ( ) as $ arg ) { if ( isset ( $ data [ $ arg ] ) ) { $ data = $ data [ $ arg ] ; } else { return null ; } } return $ data ; } | Returns the entry in the data array based on the params . Several params possible . |
6,545 | public function getPort ( ) : string { $ data = $ this -> get ( 'http_address' ) ; $ data = \ substr ( $ data , 6 , \ strlen ( $ data ) - 7 ) ; $ data = \ explode ( ':' , $ data ) ; return $ data [ 1 ] ; } | Return port of the node . |
6,546 | public function getIp ( ) : string { $ data = $ this -> get ( 'http_address' ) ; $ data = \ substr ( $ data , 6 , \ strlen ( $ data ) - 7 ) ; $ data = \ explode ( ':' , $ data ) ; return $ data [ 0 ] ; } | Return IP of the node . |
6,547 | public function getPlugins ( ) : array { if ( ! \ in_array ( 'plugins' , $ this -> _params , true ) ) { $ this -> _params [ ] = 'plugins' ; $ this -> refresh ( $ this -> _params ) ; } return $ this -> get ( 'plugins' ) ; } | Return data regarding plugins installed on this node . |
6,548 | public function hasPlugin ( $ name ) : bool { foreach ( $ this -> getPlugins ( ) as $ plugin ) { if ( $ plugin [ 'name' ] === $ name ) { return true ; } } return false ; } | Check if the given plugin is installed on this node . |
6,549 | public function getName ( ) { if ( empty ( $ this -> _name ) ) { $ this -> _name = $ this -> getInfo ( ) -> getName ( ) ; } return $ this -> _name ; } | Get the name of the node . |
6,550 | public function addDocument ( Document $ doc ) { $ endpoint = new \ Elasticsearch \ Endpoints \ Index ( ) ; if ( null !== $ doc -> getId ( ) && '' !== $ doc -> getId ( ) ) { $ endpoint -> setID ( $ doc -> getId ( ) ) ; } $ options = $ doc -> getOptions ( [ 'version' , 'version_type' , 'routing' , 'percolate' , 'parent'... | Adds the given document to the search index . |
6,551 | 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' ... | Get the document from search index . |
6,552 | public function setMapping ( $ mapping , array $ query = [ ] ) { $ mapping = Mapping :: create ( $ mapping ) ; $ mapping -> setType ( $ this ) ; return $ mapping -> send ( $ query ) ; } | Sets value type mapping for this type . |
6,553 | public function getMapping ( ) { $ response = $ this -> requestEndpoint ( new Get ( ) ) ; $ data = $ response -> getData ( ) ; $ mapping = \ array_shift ( $ data ) ; if ( isset ( $ mapping [ 'mappings' ] ) ) { return $ mapping [ 'mappings' ] ; } return [ ] ; } | Returns current mapping for the given type . |
6,554 | public function createSearch ( $ query = '' , $ options = null , BuilderInterface $ builder = null ) { $ search = $ this -> getIndex ( ) -> createSearch ( $ query , $ options , $ builder ) ; $ search -> addType ( $ this ) ; return $ search ; } | Create search object . |
6,555 | public function search ( $ query = '' , $ options = null ) { $ search = $ this -> createSearch ( $ query , $ options ) ; return $ search -> search ( ) ; } | Do a search on this type . |
6,556 | public function deleteById ( $ id , array $ options = [ ] ) { if ( empty ( $ id ) || ! \ trim ( $ id ) ) { throw new \ InvalidArgumentException ( ) ; } $ endpoint = new Delete ( ) ; $ endpoint -> setID ( $ id ) ; $ endpoint -> setParams ( $ options ) ; $ response = $ this -> requestEndpoint ( $ endpoint ) ; $ responseD... | Deletes an entry by its unique identifier . |
6,557 | public function deleteIds ( array $ ids , $ routing = false ) { return $ this -> getIndex ( ) -> getClient ( ) -> deleteIds ( $ ids , $ this -> getIndex ( ) , $ this , $ routing ) ; } | Deletes the given list of ids from this type . |
6,558 | public function deleteByQuery ( $ query , array $ options = [ ] ) { $ query = Query :: create ( $ query ) ; $ endpoint = new DeleteByQuery ( ) ; $ endpoint -> setBody ( $ query -> toArray ( ) ) ; $ endpoint -> setParams ( $ options ) ; return $ this -> requestEndpoint ( $ endpoint ) ; } | Deletes entries in the db based on a query . |
6,559 | public function request ( $ path , $ method , $ data = [ ] , array $ query = [ ] ) { $ path = $ this -> getName ( ) . '/' . $ path ; return $ this -> getIndex ( ) -> request ( $ path , $ method , $ data , $ query ) ; } | Makes calls to the elasticsearch server based on this type . |
6,560 | public function requestEndpoint ( AbstractEndpoint $ endpoint ) { $ cloned = clone $ endpoint ; $ cloned -> setType ( $ this -> getName ( ) ) ; return $ this -> getIndex ( ) -> requestEndpoint ( $ cloned ) ; } | Makes calls to the elasticsearch server with usage official client Endpoint based on this type . |
6,561 | public function get ( string $ setting = '' ) { $ requestData = $ this -> request ( ) -> getData ( ) ; $ data = \ reset ( $ requestData ) ; if ( empty ( $ data [ 'settings' ] ) || empty ( $ data [ 'settings' ] [ 'index' ] ) ) { throw new NotFoundException ( 'Index ' . $ this -> getIndex ( ) -> getName ( ) . ' not found... | Returns the current settings of the index . |
6,562 | public function getBool ( string $ setting ) : bool { $ data = $ this -> get ( $ setting ) ; return 'true' === $ data || '1' === $ data || 'on' === $ data || 'yes' === $ data ; } | Returns a setting interpreted as a bool . |
6,563 | public function setMergePolicy ( string $ key , string $ value ) : Response { $ this -> _index -> close ( ) ; $ response = $ this -> set ( [ 'merge.policy.' . $ key => $ value ] ) ; $ this -> _index -> open ( ) ; return $ response ; } | Sets the specific merge policies . |
6,564 | public function request ( array $ data = [ ] , string $ method = Request :: GET ) : Response { $ path = '_settings' ; if ( ! empty ( $ data ) ) { $ data = [ 'index' => $ data ] ; } return $ this -> getIndex ( ) -> request ( $ path , $ method , $ data ) ; } | Updates the given settings for the index . |
6,565 | protected function _retrieveHealthData ( ) : array { $ endpoint = new \ Elasticsearch \ Endpoints \ Cluster \ Health ( ) ; $ endpoint -> setParams ( [ 'level' => 'shards' ] ) ; $ response = $ this -> _client -> requestEndpoint ( $ endpoint ) ; return $ response -> getData ( ) ; } | Retrieves the health data from the cluster . |
6,566 | public function getIndices ( ) : array { $ indices = [ ] ; foreach ( $ this -> _data [ 'indices' ] as $ indexName => $ index ) { $ indices [ $ indexName ] = new Index ( $ indexName , $ index ) ; } return $ indices ; } | Gets the status of the indices . |
6,567 | public function hasError ( ) : bool { foreach ( $ this -> getResultSets ( ) as $ resultSet ) { if ( $ resultSet -> getResponse ( ) -> hasError ( ) ) { return true ; } } return false ; } | There is at least one result set with error . |
6,568 | public function setName ( string $ name ) : AbstractSuggest { if ( empty ( $ name ) ) { throw new InvalidException ( 'Suggest name has to be set' ) ; } $ this -> _name = $ name ; return $ this ; } | Sets the name of the suggest . It is automatically set by the constructor . |
6,569 | 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 ( ) ) !== $... | Set field for fuzzy query . |
6,570 | public function setFieldOption ( string $ option , $ value ) : self { $ params = $ this -> getParams ( ) ; if ( \ count ( $ params ) < 1 ) { throw new InvalidException ( 'No field has been set' ) ; } $ key = \ key ( $ params ) ; $ params [ $ key ] [ $ option ] = $ value ; return $ this -> setParam ( $ key , $ params [ ... | Set optional parameters on the existing query . |
6,571 | public function getData ( ) { if ( isset ( $ this -> _hit [ 'fields' ] ) ) { return isset ( $ this -> _hit [ '_source' ] ) ? \ array_merge ( $ this -> getFields ( ) , $ this -> getSource ( ) ) : $ this -> getFields ( ) ; } return $ this -> getSource ( ) ; } | Returns result data . |
6,572 | public function getDocument ( ) { $ doc = new Document ( ) ; $ doc -> setData ( $ this -> getSource ( ) ) ; $ hit = $ this -> getHit ( ) ; unset ( $ hit [ '_source' ] ) ; unset ( $ hit [ '_explanation' ] ) ; unset ( $ hit [ 'highlight' ] ) ; unset ( $ hit [ '_score' ] ) ; $ doc -> setParams ( $ hit ) ; return $ doc ; } | Returns Document . |
6,573 | 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 ( empty ( $ this -> _processors [ 'processors'... | Create a Pipeline . |
6,574 | public function getPipeline ( string $ id ) { $ endpoint = new Get ( ) ; $ endpoint -> setID ( $ id ) ; return $ this -> requestEndpoint ( $ endpoint ) ; } | Get a Pipeline Object . |
6,575 | public function deletePipeline ( string $ id ) { $ endpoint = new Delete ( ) ; $ endpoint -> setID ( $ id ) ; return $ this -> requestEndpoint ( $ endpoint ) ; } | Delete a Pipeline . |
6,576 | public function addProcessor ( AbstractProcessor $ processor ) { if ( empty ( $ this -> _processors ) ) { $ this -> _processors [ 'processors' ] = $ processor -> toArray ( ) ; $ this -> _params [ 'processors' ] = [ ] ; } else { $ this -> _processors [ 'processors' ] = \ array_merge ( $ this -> _processors [ 'processors... | Add a processor . |
6,577 | public function getFailures ( ) : array { $ errors = [ ] ; foreach ( $ this -> getActionExceptions ( ) as $ actionException ) { $ errors [ ] = $ actionException -> getMessage ( ) ; } return $ errors ; } | Returns array of failed actions . |
6,578 | public function setExtendedBounds ( string $ min = '' , string $ max = '' ) : self { $ bounds = [ ] ; $ bounds [ 'min' ] = $ min ; $ bounds [ 'max' ] = $ max ; if ( \ strtotime ( $ min ) > \ strtotime ( $ max ) ) { $ bounds [ 'min' ] = $ max ; $ bounds [ 'max' ] = $ min ; } return $ this -> setParam ( 'extended_bounds'... | Set extended bounds option . |
6,579 | public function addFile ( $ key , $ filepath , $ mimeType = '' ) { $ value = \ base64_encode ( \ file_get_contents ( $ filepath ) ) ; if ( ! empty ( $ mimeType ) ) { $ value = [ '_content_type' => $ mimeType , '_name' => $ filepath , '_content' => $ value ] ; } $ this -> set ( $ key , $ value ) ; return $ this ; } | Adds a file to the index . |
6,580 | public function setValue ( string $ key , string $ value , float $ boost = 1.0 ) : self { return $ this -> setParam ( $ key , [ 'value' => $ value , 'boost' => $ boost ] ) ; } | Sets the query expression for a key with its boost value . |
6,581 | protected function _setQuery ( string $ type , $ args ) : self { if ( ! \ is_array ( $ args ) && ! ( $ args instanceof AbstractSpanQuery ) ) { throw new InvalidException ( 'Invalid parameter. Has to be array or instance of Elastica\Query\AbstractSpanQuery' ) ; } return $ this -> setParam ( $ type , $ args ) ; } | Sets a query to the current object . |
6,582 | 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 ( ) ) ; case \ is_array ( $ query ) : return new self ( $ query ) ; case \ is_string... | Transforms the argument to a query object . |
6,583 | public function setScriptFields ( $ scriptFields ) { if ( \ is_array ( $ scriptFields ) ) { $ scriptFields = new ScriptFields ( $ scriptFields ) ; } return $ this -> setParam ( 'script_fields' , $ scriptFields ) ; } | Set script fields . |
6,584 | public function addScriptField ( $ name , AbstractScript $ script ) { if ( isset ( $ this -> _params [ 'script_fields' ] ) ) { $ this -> _params [ 'script_fields' ] -> addScript ( $ name , $ script ) ; } else { $ this -> setScriptFields ( [ $ name => $ script ] ) ; } return $ this ; } | Adds a Script to the query . |
6,585 | 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... | Converts all query params to an array . |
6,586 | public function setRescore ( $ rescore ) { if ( \ is_array ( $ rescore ) ) { $ buffer = [ ] ; foreach ( $ rescore as $ rescoreQuery ) { $ buffer [ ] = $ rescoreQuery ; } } else { $ buffer = $ rescore ; } return $ this -> setParam ( 'rescore' , $ buffer ) ; } | Add a Rescore . |
6,587 | public function refresh ( ) { $ this -> _response = $ this -> getIndex ( ) -> requestEndpoint ( new \ Elasticsearch \ Endpoints \ Indices \ Stats ( ) ) ; $ this -> _data = $ this -> getResponse ( ) -> getData ( ) ; } | Reloads all status data of this object . |
6,588 | public function setRescoreQuery ( $ rescoreQuery ) : Query { $ rescoreQuery = BaseQuery :: create ( $ rescoreQuery ) ; $ query = $ this -> getParam ( 'query' ) ; $ query [ 'rescore_query' ] = $ rescoreQuery ; return $ this -> setParam ( 'query' , $ query ) ; } | Sets rescoreQuery object . |
6,589 | public function setQueryWeight ( float $ weight ) : Query { $ query = $ this -> getParam ( 'query' ) ; $ query [ 'query_weight' ] = $ weight ; return $ this -> setParam ( 'query' , $ query ) ; } | Sets query_weight . |
6,590 | public function setRescoreQueryWeight ( float $ weight ) : Query { $ query = $ this -> getParam ( 'query' ) ; $ query [ 'rescore_query_weight' ] = $ weight ; return $ this -> setParam ( 'query' , $ query ) ; } | Sets rescore_query_weight . |
6,591 | public static function escapeDateMath ( $ requestUri ) { if ( empty ( $ requestUri ) ) { return $ requestUri ; } $ pos1 = \ strrpos ( $ requestUri , '>' ) ; if ( false === $ pos1 ) { return $ requestUri ; } $ pos2 = \ strpos ( $ requestUri , '/' , $ pos1 ) ; $ pos2 = false !== $ pos2 ? $ pos2 : \ strlen ( $ requestUri ... | Escapes date math symbols within request URI . |
6,592 | public static function convertRequestToCurlCommand ( Request $ request ) { $ message = 'curl -X' . \ strtoupper ( $ request -> getMethod ( ) ) . ' ' ; $ message .= '\'http://' . $ request -> getConnection ( ) -> getHost ( ) . ':' . $ request -> getConnection ( ) -> getPort ( ) . '/' ; $ message .= $ request -> getPath ... | Converts Request to Curl console command . |
6,593 | public function getError ( ) { $ error = $ this -> getFullError ( ) ; if ( ! $ error ) { return '' ; } if ( \ is_string ( $ error ) ) { return $ error ; } $ rootError = $ error ; if ( isset ( $ error [ 'root_cause' ] [ 0 ] ) ) { $ rootError = $ error [ 'root_cause' ] [ 0 ] ; } $ message = $ rootError [ 'reason' ] ; if ... | Error message . |
6,594 | public function isOk ( ) { $ data = $ this -> getData ( ) ; if ( isset ( $ data [ 'status' ] ) ) { return $ data [ 'status' ] >= 200 && $ data [ 'status' ] <= 300 ; } if ( isset ( $ data [ 'items' ] ) ) { if ( isset ( $ data [ 'errors' ] ) && true === $ data [ 'errors' ] ) { return false ; } foreach ( $ data [ 'items' ... | Checks if the query returned ok . |
6,595 | public function getData ( ) { if ( null == $ this -> _response ) { $ response = $ this -> _responseString ; try { if ( $ this -> getJsonBigintConversion ( ) ) { $ response = JSON :: parse ( $ response , true , 512 , JSON_BIGINT_AS_STRING ) ; } else { $ response = JSON :: parse ( $ response ) ; } } catch ( JSONParseExce... | Response data array . |
6,596 | public static function parse ( $ args ) { $ args = \ func_get_args ( ) ; if ( 1 === \ count ( $ args ) ) { $ args [ ] = true ; } $ array = \ call_user_func_array ( 'json_decode' , $ args ) ; if ( $ error = self :: getJsonLastErrorMsg ( ) ) { throw new JSONParseException ( $ error ) ; } return $ array ; } | Parse JSON string to an array . |
6,597 | public static function stringify ( $ args ) { $ args = \ func_get_args ( ) ; $ string = \ call_user_func_array ( 'json_encode' , $ args ) ; if ( $ error = self :: getJsonLastErrorMsg ( ) ) { throw new JSONParseException ( $ error ) ; } return $ string ; } | Convert input to JSON string with standard options . |
6,598 | public function setOrder ( string $ order , string $ direction ) : self { return $ this -> setParam ( 'order' , [ $ order => $ direction ] ) ; } | Set the bucket sort order . |
6,599 | public function setTerms ( string $ key , array $ terms ) : self { $ this -> _key = $ key ; $ this -> _terms = \ array_values ( $ terms ) ; return $ this ; } | Sets key and terms for the query . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.