This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mapping | |
{ | |
"credits": { | |
"properties": { | |
"position": { | |
"type": "integer" | |
}, | |
"person": { | |
"properties": { | |
"id": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ======================================== | |
# Testing completion suggest in ElasticSearch | |
# ======================================== | |
curl -X DELETE localhost:9200/hotels | |
curl -X PUT localhost:9200/hotels -d ' | |
{ | |
"mappings": { | |
"hotel" : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in older versions, for getting model from different controller i was using: | |
App.FoodController = Em.ArrayController.extend({ | |
addFood: function (food) { | |
var items = this.controllerFor('table').get('model').get('tab.tabItems'); | |
tabItems.createRecord({ | |
food: food | |
}) | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import lcd, local, path | |
project_dir = '/www/project/sms/' | |
env_bin_dir = project_dir + '../env/bin' | |
def deploy(): | |
with lcd(project_dir): | |
local('pwd') | |
local('git pull origin') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
q = { | |
"query": { | |
"function_score": { | |
"boost_mode": "replace", | |
"query": { | |
"ids": { | |
"values": [ | |
50, | |
80, | |
44, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ======================================== | |
# Testing simple analyzer in ElasticSearch | |
# ======================================== | |
curl -X DELETE localhost:9200/hotels | |
curl -X PUT localhost:9200/hotels -d ' | |
{ | |
"index": { | |
"analysis": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TagTrans extends Tag { | |
function generate() | |
{ | |
$value = '""'; | |
$lng = isset($_COOKIE['lang']) ? $_COOKIE['lang'] : 'en'; | |
if(isset($this->parameters[$lng])){ | |
$value = '"' . $this->attr_parse($this->parameters[$lng]) . '"'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ======================================== | |
# Nested facets filtering by parent in ElasticSearch | |
# -------------------------------------------------- | |
# I need to get facets of departments for specific person for one movie genre: | |
# facets for credit.department where genre=comedy, credits.person_id=1 | |
# I am using include_in_parent:true mapping to be able to facet_filter by parent genre | |
# ======================================== | |
curl -X DELETE localhost:9200/movies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ======================================== | |
curl -X DELETE localhost:9200/movies | |
curl -X PUT localhost:9200/movies -d ' | |
{ | |
"mappings": { | |
"movie": { | |
"properties": { | |
"name": { "type": "string" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XGET "http://localhost:9200/movies/_search" -d' | |
{ | |
"query": { | |
"nested": { | |
"path": "credits", | |
"query": { | |
"match": { | |
"credits.person_id": 1 | |
} | |
} |