Questions tagged [elastica]

Elastica is a PHP client for the elasticsearch full-text search and analytics engine.

Introduction

Elastica is open source and you can download or clone the source code on Github from ruflin/Elastica.

You can find the complete API here.

Requirements

Elastica v.0.20.5 require PHP 5.3 >=, for using Elastica on PHP 5.2 let see Elastica v0.19.8

Download

You can download this project in either zip or tar formats.

The prefered way is to clone Elastica with Git by running:

$ git clone git://github.com/ruflin/Elastica

Composer

You can also install Elastica by using composer:

{
    "require": {
       "ruflin/Elastica": "dev-master"
    }
}
257 questions
4
votes
4 answers

Search in multiple indexes in elastica

I am looking for a way to search in more than one index at the same time using Elastica. I have an index products, and an index user. products contains {product_id, product_name, price} and user contains {product_id, user_name, date}. Knowing that…
Alexandre Elshobokshy
  • 10,720
  • 6
  • 27
  • 57
4
votes
1 answer

How to find documents containing polygons by point?

I have documents in ES that have a "boundaries" field. This is an example of the contents of the field: https://gist.github.com/litzinger/a95342dedc0081c8db8d Given a lon/lat point, I need to be able to query this index to find which document(s)…
Brian Litzinger
  • 5,409
  • 3
  • 23
  • 21
4
votes
0 answers

Finding query paramters with knp paginator and FOSElastica

I am having trouble properly implementing knp paginator's sorting functionality into my Symfony2 application. I believe that the reason I am running into problems is because I don't know how FOSElastica builds queries from its built-in paginator,…
Byte Lab
  • 1,576
  • 2
  • 17
  • 42
4
votes
1 answer

Working with date ranges in Elasticsearch and Symfony2

I have a standard Datetime field in my Doctrine-based entity class: /** * @ORM\Column(type="datetime") */ private $occurring; This generates a DateTime object and works as expected. But a problem occurs when this object is integrated with the…
t j
  • 7,026
  • 12
  • 46
  • 66
4
votes
1 answer

Elastica: Best way to check if document with Id x exists?

Using the PHP Elastica library, I'm wondering what is the best way to check whether a document with Id=1 exists? I was doing as follows: $docPre = $elasticaType->getDocument(1); if ($docPre) { //do some stuff... } else { //do something…
RayOnAir
  • 2,038
  • 2
  • 22
  • 33
4
votes
1 answer

Combination of two different filters in one Query - Elastica

my question is very simple. I want to combine two filters one filter_bool and one filter_range in one query in Elastica. The code is public function getAdvancedTweetsEs($keyword, $location, $datepicker, $datepicker1, $offset) { $elasticaClient =…
4
votes
2 answers

Class not found even though it is located where I am looking for it

I am trying to load a class in order for a PHP script that I wrote, with help of the classes' documentation, to work. Since my server is running PHP 5.3, the documentation recommended loading the class like…
IMUXIxD
  • 1,223
  • 5
  • 23
  • 44
4
votes
2 answers

How to query using Elastica

This is my first time using Elastica and querying data from the ElasticSearch For me, as starter I have a question on how to query the code below using Elastica?: curl 'http://localhost:9200/myindex/_search?pretty=true' -d '{ "query" : { …
Wondering Coder
  • 1,652
  • 9
  • 31
  • 51
3
votes
0 answers

Php Elastica - how to resolve - No enabled connection error - in long cycle

I have a php console script which processes long array in foreach cycle and send Elasticsearch bulks to database. I need to solve case if bulk insert fails on connection error like: No enabled connection. I would like to catch it and try it again.…
Čamo
  • 3,863
  • 13
  • 62
  • 114
3
votes
1 answer

simple match query with Elastica QueryBuilder

I try lot of thing for executing a simple Match value request in ElasticSearch with PHP - Elastica library (FosElasticaBundle). But nothing run. Do you have a idea for run correctly this kind of code : $match = new…
miltone
  • 4,416
  • 11
  • 42
  • 76
3
votes
1 answer

Installation and using elasticsearch php client on Windows Xampp

I'm downloaded the elasticsearch-5.1.1.zip from the https://www.elastic.co/downloads/elasticsearch Then download the Elastica A PHP client for elasticsearch via composer with this command composer require ruflin/elastica:dev-master Now i want to…
devugur
  • 1,339
  • 1
  • 19
  • 25
3
votes
1 answer

Elastic search scoring is always 0

Any idea why ElasticSearch would always return a _score of 0 for all the search queries i do ? Using Elastica, i am doing something like: $elasticaClient= $this->getElasticaClient(); $elasticaIndex =…
Twisted1919
  • 2,430
  • 1
  • 19
  • 30
3
votes
1 answer

FOSElasticaBundle: Is it possible to change "query_builder_method" in controller?

According to FOSElasticaBundle documentation it is possible to configure application to use custom query builder method like this: user: persistence: elastica_to_model_transformer: query_builder_method:…
Jakub Matczak
  • 15,341
  • 5
  • 46
  • 64
3
votes
3 answers

how to update multiple data in one go in elastica php?

how to update multiple datas in elastica ? the logic is like , I have an array or a string of id, then I need to update the status property of all the datas connected to each or to that id in one go, so how to do that?, this document don't have…
sasori
  • 5,249
  • 16
  • 86
  • 138
3
votes
1 answer

Elasticsearch aggregations, get additional field in bucket

I query ES index to filter results and get aggregations by selected terms. A sample query is like this: GET buyer_requests/vehicle_requests/_search { "query": { "filtered": { "filter": { "and": [ { …
ppavlovic
  • 53
  • 7
1
2
3
17 18