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
1
vote
1 answer

Sorting by similar numeric value in Elasticsearch

Lets imagine simple elastic documents like this: { title: 'Samsung Galaxy S5' //string price 599.45 //float }, { title: 'Cover for Samsung Galaxy S5' price: 5.49 } Now I want to write bool query that will take some title and some price, like…
galdikas
  • 1,609
  • 5
  • 19
  • 43
1
vote
1 answer

elasticsearch query by array of id result returned is not sorted by the array of id pass in

I am using elastica and below is my query : $query = new Query(); $query->setSize(5); $qb = new \Elastica\Query\Ids(); $qb->addId("id_5"); $qb->addId("id_3"); $qb->addId("id_4"); $qb->addId("id_1"); …
MinFu
  • 353
  • 1
  • 13
1
vote
0 answers

ElasticSearch Aggregations with script doc_values

I have a field "location_facet", which is a strig with mapping "location_facet": { "type": "string", "index": "not_analyzed", "include_in_all": true }, In this field I have…
Mutatos
  • 1,675
  • 4
  • 25
  • 55
1
vote
0 answers

Elastica rewrite logic from old version to the new one 3.1

I am in the way to reqrite my classes to the new logic of Elastica and would like to know if I am on the right way. My actual solution for a query with an filter is:
Mutatos
  • 1,675
  • 4
  • 25
  • 55
1
vote
1 answer

Check Elasticsearch document similarity before indexing

Ok after having pulling my hair off all day long trying to figure that one out I decided to get some input from the community. Should be mentioned that I'm fairly new to Elasticsearch. The idea is that I have an ES index containing some documents…
SebScoFr
  • 881
  • 1
  • 9
  • 24
1
vote
1 answer

Field collapsing on collection

Suppose I've a very simple index. Blog post and blog categories. One blog belong to one or more categories. I want to find for each category the last 3 posts. How can I do this ? I've read about "Field collapsing" here…
Hpatoio
  • 1,785
  • 1
  • 15
  • 22
1
vote
1 answer

Can this be done in a Elastic Search Query?

I am currently solving this by pre-calculating a score before inserting the events into Elastic Search. However because it is based on a date I have to recalculate the score daily. Would it be possible to do this calculation during a query? Data: { …
sschueller
  • 533
  • 1
  • 6
  • 18
1
vote
0 answers

Elastica FOSElastica Symfony2 analyzers are not working

I am on my way to figure out, how Elastica/FOSElastica is working. I got it running fine for like really simple search queries, where the product name exactly match my search string. Since this is not a good way to search, I would have to add…
RoyRobsen
  • 457
  • 1
  • 9
  • 20
1
vote
1 answer

Elasticsearch PHP longest prefix match

I am currently using the FOSElasticaBundle in Symfony2 and I am having a hard time trying to build a search to match the longest prefix. I am aware of the 100 examples that are on the Internet to perform autocomplete-like searches using this.…
1
vote
1 answer

Getting unique results with elasticsearch acorrding to field

I'm using FOSElasticaBundle with Symfony2 on my project and there are entry and user tables on MySQL database and each entry belongs to one user. I want to get just one entry per a user among the whole entries from the database. Entries…
alpcanaydin
  • 113
  • 1
  • 1
  • 6
1
vote
1 answer

Undefined index on FOSElasticaBundle

I installed FOSElasticaBundle on Symfony2 to find data on elasticsearch. I followed the instruction, but I have an error and I don't know how to deal with it. The error is as follows: Notice: Undefined index: bluecoat-syslog 500 Internal Server…
toff
  • 11
  • 3
1
vote
1 answer

how to transfer elastic data from one server to another

How do I move Elasticsearch data from one server to another? I have server A running Elasticsearch 1.4.2 on one local node with multiple indices. I would like to copy that data to server B running Elasticsearch with the same version. The…
Ironman
  • 173
  • 1
  • 3
  • 10
1
vote
0 answers

How configure bundle based on other service?

I want to configure my index types of Elastica dynamically based on entity list which I can get from entity repository. To do this I must have instance of repository so doctrine EntityManager must exist so Depedency Inject container must by…
1
vote
0 answers

Php Elastica\Exception\ResponseException with message NoShardAvailableActionException[[index][0] null]

I am using php elastica client (https://github.com/ruflin/Elastica) for adding documents in elasticsearch index. What happens is, the first time I try to add a document, I get this error: 'Elastica\Exception\ResponseException' with message …
Tarun
  • 152
  • 1
  • 15
1
vote
1 answer

How do I group documents in elasticsearch by a single field?

If I have a bunch of documents in elaticsearch that I want to be returned grouped by the one field of the document, how do I do it? Also I need it to consistently return a fixed number of results (using set maxresults) For example if I have a bunch…
Vinu K S
  • 783
  • 1
  • 8
  • 18