Download the PHP package elastic/site-search-php without Composer

On this page you can find all versions of the php package elastic/site-search-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package site-search-php

Elastic Site Search Logo

GitHub release CircleCI build Dependencies status

A first-party PHP client for the Elastic Site Search API.

Contents


Getting started 🐣

Using this client assumes that you have already created a Site Search account on https://www.elastic.co/products/site-search.

You can install the client in your project by using composer:

Usage

Configuring the client

Basic client instantiation

To instantiate a new client you can use \Elastic\SiteSearch\Client\ClientBuilder:

Notes:

Basic usage

Retrieve or create an engine

Most methods of the API require that you have access to an Engine.

To check if an Engine exists and retrieve its configuration, you can use the Client::getEngine method :

If the Engine does not exists yet, you can create it by using the Client::createEngine method :

The second parameter ($language) is optional or can be set to null. Then the Engine will be created using the universal language. The list of supported language is available here : https://swiftype.com/documentation/site-search/overview#language-optimization

Document types

When using Site Search every document has an associated DocumentType.

You can list available document types in an engine by using the Client::listDocumentTypes method:

In order to index documents you need to create at least one DocumentType in your engine. This can be done by using the Client::createDocumentType` method:

Index some documents

In order to index some documents in the Engine you can use the Client::createOrUpdateDocuments method:

Notes:

Search

In order to search in your Engine you can use the Client::search method :

An optional $searchRequestParams can be used to pass additional parameters to the Search API endpoint (pagination, filters, facets, ...):

Allowed params are :

Param name Description Documentation URL
per_page and page Control pagination.  https://swiftype.com/documentation/site-search/searching/pagination
document_types Searched document types. https://swiftype.com/documentation/site-search/searching/documenttypes
filters Search filters https://swiftype.com/documentation/site-search/searching/filtering
facets Search facets. https://swiftype.com/documentation/site-search/searching/faceting
boosts Search boosts.   https://swiftype.com/documentation/site-search/searching/boosting
fetch_fields Fields returned by the search. https://swiftype.com/documentation/site-search/searching/fetch-fields
search_fields Field (weighted) used by the search. https://swiftype.com/documentation/site-search/searching/field-weights
highlight_fields Field highlighting configuration. https://swiftype.com/documentation/site-search/searching/highlight-fields
sort_field and sort_direction Result sort order configuration https://swiftype.com/documentation/site-search/searching/sorting
spelling Control over the spellchecker behavior. https://swiftype.com/documentation/site-search/searching/spelling

Clients methods

Method Description Documentation
asyncCreateOrUpdateDocuments Async bulk creation or update of documents in an engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $documents (required)
Endpoint Documentation
createDocument Create a new document in an engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $documentExternalId (required)
- $documentFields (required)
Endpoint Documentation
createDocumentType Create a new document type in an engine.

Parameters :
- $engineName (required)
- $documentTypeName (required)
Endpoint Documentation
createDocuments Bulk creation of documents in an engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $documents (required)
Endpoint Documentation
createEngine Create a new API based engine.

Parameters :
- $engineName (required)
- $engineLanguage
Endpoint Documentation
createOrUpdateDocument Create or update a document in an engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $documentExternalId (required)
- $documentFields (required)
Endpoint Documentation
createOrUpdateDocuments Bulk creation or update of documents in an engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $documents (required)
Endpoint Documentation
deleteDocument Delete a document from the engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $externalId (required)
Endpoint Documentation
deleteDocumentType Delete a document type by id.

Parameters :
- $engineName (required)
- $documentTypeId (required)
Endpoint Documentation
deleteDocuments Bulk delete of documents in an engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $documents (required)
Endpoint Documentation
deleteEngine Delete an engine by name.

Parameters :
- $engineName (required)
Endpoint Documentation
getAutoselectsCountAnalyticsDocumentType Retrieve number of autoselects (number of clicked results in the autocomplete) per day over a period for a document type.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $startDate
- $endDate
Endpoint Documentation
getAutoselectsCountAnalyticsEngine Retrieve number of autoselects (number of clicked results in the autocomplete) per day over a period for an engine.

Parameters :
- $engineName (required)
- $startDate
- $endDate
Endpoint Documentation
getClicksCountAnalyticsDocumentType Retrieve number of clicks per day over a period for a document type.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $startDate
- $endDate
Endpoint Documentation
getClicksCountAnalyticsEngine Retrieve number of clicks per day over a period for an engine.

Parameters :
- $engineName (required)
- $startDate
- $endDate
Endpoint Documentation
getDocument Retrieve a document from the engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $externalId (required)
Endpoint Documentation
getDocumentReceipts Check the status of document receipts issued by aync bulk indexing.

Parameters :
- $receiptIds (required)
Endpoint Documentation
getDocumentType Get a document type by id.

Parameters :
- $engineName (required)
- $documentTypeId (required)
Endpoint Documentation
getEngine Retrieves an engine by name.

Parameters :
- $engineName (required)
Endpoint Documentation
getSearchCountAnalyticsDocumentType Get the number of searches per day for an document type.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $startDate
- $endDate
Endpoint Documentation
getSearchCountAnalyticsEngine Get the number of searches per day for an engine.

Parameters :
- $engineName (required)
- $startDate
- $endDate
Endpoint Documentation
getTopNoResultQueriesAnalyticsDocumentType Retrieve top queries with no result and usage count over a period for a document type.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $startDate
- $endDate
- $currentPage
- $pageSize
Endpoint Documentation
getTopNoResultQueriesAnalyticsEngine Retrieve top queries with no result and usage count over a period for an engine.

Parameters :
- $engineName (required)
- $startDate
- $endDate
- $currentPage
- $pageSize
Endpoint Documentation
getTopQueriesAnalyticsDocumentType Retrieve top queries and usage count over a period for a document type.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $startDate
- $endDate
- $currentPage
- $pageSize
Endpoint Documentation
getTopQueriesAnalyticsEngine Retrieve top queries and usage count over a period for an engine.

Parameters :
- $engineName (required)
- $startDate
- $endDate
- $currentPage
- $pageSize
Endpoint Documentation
listDocumentTypes List all document types for an engine.

Parameters :
- $engineName (required)
Endpoint Documentation
listDocuments List all documents in an engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
Endpoint Documentation
listEngines Retrieves all engines with optional pagination support.

Parameters :
- $currentPage
- $pageSize
Endpoint Documentation
logClickthrough Record a clickthrough for a particular result.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $documentId (required)
- $queryText (required)
Endpoint Documentation
search Run a search request accross an engine.

Parameters :
- $engineName (required)
- $queryText (required)
- $searchRequestParams
Endpoint Documentation
suggest Run an autocomplete search request accross an engine.

Parameters :
- $engineName (required)
- $queryText (required)
- $searchRequestParams
Endpoint Documentation
updateDocumentFields Update fields of a document.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $externalId (required)
- $fields (required)
Endpoint Documentation
updateDocuments Bulk update of documents in an engine.

Parameters :
- $engineName (required)
- $documentTypeId (required)
- $documents (required)
Endpoint Documentation

Development

Code for the endpoints is generated automatically using a custom version of OpenAPI Generator.

To regenerate endpoints, use the docker laucher packaged in vendor/bin:

The custom generator will be built and launched using the following Open API spec file : resources/api/api-spec.yml.

You can then commit and PR the modified api-spec file and your endpoints code files.

The client class and readme may be changed in some cases. Do not forget to include them in your commit!

FAQ 🔮

Where do I report issues with the client?

If something is not working as expected, please open an issue.

Where can I find the full API documentation ?

Your best bet is to read the documentation.

Where else can I go to get help?

You can checkout the Elastic community discuss forums.

Contribute 🚀

We welcome contributors to the project. Before you begin, a couple notes...

License 📗

Apache 2.0 © Elastic

Thank you to all the contributors!


All versions of site-search-php with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6|^7.0|^8.0
elastic/openapi-codegen Version ^1.0.6
psr/log Version ^1|^2|^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package elastic/site-search-php contains the following files

Loading the files please wait ....