Skip to content

Instantly share code, notes, and snippets.

View damienalexandre's full-sized avatar
❤️
I̴͍͋ ̶͉͠Ḻ̸̅O̸͈̚V̷̨͒E̸̛ ̵̲̓Ü̷Ṅ̴̩I̴̳͑C̵͉͂O̷̹͗D̸̤̃È̴̪

Damien Alexandre damienalexandre

❤️
I̴͍͋ ̶͉͠Ḻ̸̅O̸͈̚V̷̨͒E̸̛ ̵̲̓Ü̷Ṅ̴̩I̴̳͑C̵͉͂O̷̹͗D̸̤̃È̴̪
View GitHub Profile
@damienalexandre
damienalexandre / gist:5966477
Created July 10, 2013 13:55
Example of error from ES.
[2013-07-10 14:32:29,599][DEBUG][action.search.type ] [Kehl of Tauran] [catalog_withuserdatas][0], node[FILbNMh3SDq4de9z3c9Zog], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@52bad42c]
org.elasticsearch.search.SearchParseException: [catalog_withuserdatas][0]: query[ConstantScore(cache(terms(id:catalog_withuserdatas/playlist/1/tracks.id)))],from[-1],size[-1],sort[<custom:"name": org.elasticsearch.index.fielddata.fieldcomparator.BytesRefFieldComparatorSource@64f600fc>]: Parse Failure [Failed to parse source [
{
"query" : {
"filtered" : {
"query" : {
"query_string" : { "query" : "*" }
},
"filter" : {
"terms" : {
@damienalexandre
damienalexandre / suggest.sh
Last active December 18, 2015 09:48
How to keep you warm thank to your CPU and ES :o)
curl -XDELETE 'http://localhost:9200/pony_index_tmp'
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
"number_of_shards": 5,
"number_of_replicas": 1,
"analysis": {
"analyzer": {
"francais": {
@damienalexandre
damienalexandre / 1597.sh
Created June 11, 2013 15:19
Issue 1957
curl -XDELETE 'http://localhost:9200/pony_index_tmp'
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
"number_of_shards": 1,
"number_of_replicas": 1
}'
curl -XDELETE 'http://localhost:9200/pony_index_tmp'
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
"number_of_shards": 5,
"number_of_replicas": 1,
"analysis": {
"analyzer": {
"francais": {
curl -XDELETE 'http://localhost:9200/pony_index_tmp'
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
"number_of_shards": 5,
"number_of_replicas": 1,
"analysis": {
"analyzer": {
"francais": {
<?php
public function indexAction($page)
{
$request = $this->container->get('request');
$routeName = $request->get('_route');
$f_r = $request->query->get('f_r');
@damienalexandre
damienalexandre / facets.php
Created May 28, 2013 08:30
Here is an example of how to get a query Filter from a list of Facet and user query (how to apply a facet on a query) with Elastica.
<?php
/**
* Return query Filter from a list of query string & allowed Facets
*
* @param array $query The user query (facet_name => query, facet_name => query...)
* @param array $allowed_facets An array of Elastica\Facet
*
* @return \Elastica\Filter\AbstractFilter (if multiple filters, they are combined in BoolAnd filter)
*/
private function getFacetsFilters($query, $allowed_facets)
@damienalexandre
damienalexandre / pony.sh
Created April 15, 2013 09:13
Facets example with ElasticSearch. Building a Filtered Query manualy (or via Elastica) is hell.
# for real, I have a mapping and my color is not "indexed"
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
settings: {
number_of_shards: 1,
number_of_replicas: 0
}
}'
curl -XPOST "http://localhost:9200/pony_index_tmp/pony/1" -d '
@damienalexandre
damienalexandre / robot.js
Created December 6, 2012 17:25
roundead
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.turn(150);