Skip to content

Instantly share code, notes, and snippets.


Zachary Tong polyfractal

View GitHub Profile
View gist:4063964
View gist:4542494
#create a test index with shingle mapping
curl -XPUT localhost:9200/test -d '{
"filter":["standard", "lowercase", "filter_stop", "filter_shingle"]
polyfractal / gist:4704772
Last active Sep 16, 2020
Commands associated with the "Starts-with" ElasticSearch tutorial
View gist:4704772
#Create the index with no mapping
curl -XPUT localhost:9200/startswith/
#add some data
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"river dog"}'
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"data"}'
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"drive"}'
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"drunk"}'
curl -XPOST localhost:9200/startswith/test/ -d '{"title":"dzone"}'
View gist:4947188
-Added "include_in_root" for each nested object.
-Removed the "nested" params from the last facet
This basically copies the nested doc into the root doc. You then reference the root "inner object" rather than the "nested object" to get the data. Be careful though, this breaks down if you have multiple nested docs that share the same name (e.g. array of nested), since the facet will operate on the entire array instead of individual ones.
See this thread for more info:
polyfractal / gist:4959909
Last active Dec 13, 2015
Mapping for indexing throughput benchmark
View gist:4959909
"settings": {
"number_of_shards": 3,
"number_of_replicas": 0,
"index": {
"analysis": {
"analyzer": {
"analyzer_shingle": {
"tokenizer": "standard",
"filter": [
polyfractal / gist:4968387
Created Feb 16, 2013
Logging.yml to enable a SocketAppender, which will be used to talk to Logstash
View gist:4968387
rootLogger: INFO, console, file, socketappender
# log action execution errors for easier debugging
action: DEBUG
# reduce the logging for aws, too much is logged under the default INFO
com.amazonaws: WARN
# gateway
#gateway: DEBUG
#index.gateway: DEBUG
polyfractal / gist:4997040
Created Feb 20, 2013
Reroute API breaks Cluster/Node/Stats API. More details
View gist:4997040
##Listed in order of operations and the resulting output:
## reroute the shards - executed on C1 client node
$curl -XPOST 'localhost:9200/_cluster/reroute' -d '{
View import.php
require 'vendor/autoload.php';
use Sherlock\Sherlock;
function pprint($value) {
echo "\r\n";
View gist:5482219
View gist:5506185
public function assertThrowsException($exception, $code)
$raisedException = null;
try {
} catch (\Exception $raisedException) {
// No more code, we only want to catch the exception in $raisedException.
$this->assertInstanceOf($exception, $raisedException);
You can’t perform that action at this time.