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 | |
// now | |
$date = date_create('2010-12-31 22:00:01', timezone_open('Europe/Amsterdam')); | |
// Buenos Aires | |
date_timezone_set($date, timezone_open('America/Argentina/Buenos_Aires')); | |
echo $date->format('Y-m-d H:i:s'); | |
// 2010-12-31 18:00:01 | |
// UTC |
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
/** | |
* Be sure to include library scripts in this order. Can be placed either | |
* in the header or footer. | |
*/ | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-infinitescroll/2.0b2.120519/jquery.infinitescroll.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/masonry/3.1.2/masonry.pkgd.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.0.4/jquery.imagesloaded.min.js"></script> |
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
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
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
Each Aggregation makes buckets, it shows the number of documents | |
GET /vehicles/cars/_search | |
{ | |
"aggs": { | |
"popular_cars" : { | |
"terms" : { | |
"field" : "make.keyword" | |
}, |
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
GET /vehicles/cars/_search | |
{ | |
"from": 0, | |
"size" : 5, | |
"query": { | |
"match_all": {} | |
}, | |
"sort": [ | |
{ "price": { "order": "desc"} } | |
] |
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
"course_description^2" | |
will increaes the field relevance |
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
GET courses/_search | |
{ | |
"query" :{ | |
"bool":{ | |
"filter" :{ | |
"match": {"name": "accounting"} | |
} | |
} | |
} | |
} |
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
"query" :{ | |
"match_phrase_prefix": { | |
"course_description": "from the business school taken by fin" | |
} | |
} | |
"query" :{ | |
"match_phrase": { | |
"course_description": "from the business school taken by fin" | |
} |
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
GET courses/_search | |
{ | |
"query" :{ | |
"multi_match": { | |
"query": "accounting", | |
"fields": ["name","professor.department"] | |
} | |
} | |
} |
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
GET courses/_search | |
{ | |
"query" :{ | |
"bool": { | |
"must": [ | |
{"match" : {"name" : "accounting"}} | |
], | |
"must_not": [ | |
{"match" : {"professor.name": "bill"}} |
NewerOlder