Download the PHP package earc/data-elasticsearch without Composer

On this page you can find all versions of the php package earc/data-elasticsearch. 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 data-elasticsearch

eArc-data-elasticsearch

Elasticsearch-bridge for the earc/data persistence handler.

table of contents

installation

Install the earc data elasticsearch library via composer.

basic usage

bootstrap

Initialize the earc/data package.

If your elasticsearch server is not located at localhost:9200 or you need to authenticate, you have to configure it.

Then register the earc/data-elasticsearch bridge.

Now your entities will be indexed and removed from the index automatically. You are ready to search your earc/data entities via elasticsearch.

initialize index

If you have persisted entities before installing the earc/data-elasticsearch bridge, you can use IndexService::rebuildIndex() to index the entities that are in your data-store already.

This has to be done only once. New entities and updates are indexed automatically.

search

To search is very straight forward.

This would find all entities of the MyUserEntitiy class with a name property of Max or Moritz and an age property of 21.

If you don't need the primary keys data_find_entities is shorter.

To find all existing primary keys use the empty array.

enhanced syntax

earc/data-elasticsearch supports more than the complete earc/data data_find syntax. From the support for ranges and full text search to every elasticsearch query possible. This one size fits all approach is simple to start with, but as hard as the elasticsearch dsl to master.

range

The use of the range is done via a ..range postfix.

This gives an open range above 18.

Closed ranges are possible too.

match

To perform a full text search (use the elasticsearch verb match against a text field) use the ..match postfix.

text

The ..text postfix gives a keyword (term) search against a text field. This becomes handy if you search a single word but doesn't know if your target is uppercase, lowercase or uppercase first.

exists

Elasticsearch does not know null values. Instead of IS NOT NULL you can check if a property exists, which is in most cases the same.

Or check if a property does not exist, which is similar to IS NULL.

_id

The getter getPrimaryKey() is used as elasticsearch document id. Thus, you can use the property _id to test against one or more primary keys.

embedded entity

To query embedded entities you can use the dot syntax.

embedded entity collection (nested)

Embedded entity collections have two properties _entityName and _items. _items invoke a nested query.

joins

Elasticsearch does not know joins, but they can be realized via two separate queries.

This works for one-to-one and many-to-one relations.

If your joined entity uses a collection e.g. the join represents a one-to-many or a many-to-many relation, then you have to use the .items embedded syntax.

raw query

You can always call upon the raw power of the elasticsearch dsl via the .raw postfix.

raw search body

To write the complete search in the elasticsearch dsl use the .raw_body key.

advanced usage

index name

The indices of the entities are named earc-data- plus the lowercase version of the fully qualified class name where the backslash \\ is replaced by the minus sign -. The earc-data prefix can be configured.

entity whitelist and blacklist

All entities are indexed by default. This can be changed via whitelisting or blacklisting.

Only the entities on the whitelist will be indexed.

All but the entities on the blacklist will be indexed.

If black- and whitelist is configured the whitelist is used only.

extend the elasticsearch bridge

To extend the elasticsearch bridge just decorate one of its classes.

Since there are only three classes (DocumentFactory, ElasticsearchDataBridge and IndexService) copy and pasting them into your project is a reasonable option.

releases

release 0.0


All versions of data-elasticsearch with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
earc/data Version ^0.0
elasticsearch/elasticsearch Version ^7.12
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 earc/data-elasticsearch contains the following files

Loading the files please wait ....