Skip to content

Instantly share code, notes, and snippets.

View fernandojmartin's full-sized avatar

Fernando Javier Martin fernandojmartin

  • Freelance/remote
  • Buenos Aires, Argentina
View GitHub Profile
@fernandojmartin
fernandojmartin / gist:5311012
Created April 4, 2013 14:50
The mapping and the user object
// MAPPING
curl -XGET http://localhost:9200/directorio/_mapping?pretty=true
{
"usuario" : {
"properties" : {
"avatar" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs"
// This is what I have now:
$ curl -XGET localhost:9200/directorio/_mapping?pretty=true
{
"directorio" : {
"usuario" : {
"properties" : {
"avatar" : {
"type" : "string",
"index" : "not_analyzed",
@fernandojmartin
fernandojmartin / buildVisialTree.php
Created February 22, 2021 19:54
Build a tree from collection of elements
<?php
$events = [
["id" => 14, "name" => 'root event', "parent_id" => 0],
["id" => 15, "name" => 'an event', "parent_id" => 14],
["id" => 33, "name" => 'a sub event', "parent_id" => 15],
["id" => 52, "name" => 'a sub event (2)', "parent_id" => 33],
["id" => 68, "name" => 'another root event', "parent_id" => 0],
["id" => 83, "name" => 'yet another root event', "parent_id" => 0],
["id" => 84, "name" => 'another sub event', "parent_id" => 83],
["id" => 87, "name" => 'another sub event (x)', "parent_id" => 83],