Skip to content

Instantly share code, notes, and snippets.

View dadoonet's full-sized avatar
🇪🇺
From Europe with ❤️

David Pilato dadoonet

🇪🇺
From Europe with ❤️
View GitHub Profile
@dadoonet
dadoonet / test-suggest.sh
Last active December 21, 2015 09:49
Trying Suggest API on multifields
curl -XDELETE "http://localhost:9200/test?pretty"
curl -XPOST "http://localhost:9200/test?pretty" -d '{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis":{
"analyzer":{
"suggest":{
"type": "custom",
@dadoonet
dadoonet / gist:6113034
Last active December 20, 2015 10:08 — forked from anonymous/gist:6109593
echo "Deleting old ElasticSearch index..."
curl -XDELETE 'localhost:9200/arrtest'; echo
echo "Creating new ElasticSearch index..."
curl -XPUT 'localhost:9200/arrtest/?pretty=1' -d '
{
"mappings" : {
"cust2" : {
"properties" : {
"firstName" : {
@dadoonet
dadoonet / ngram.sh
Created July 8, 2013 19:40
Using ngram with multifield
# Delete index
curl -XDELETE 'http://localhost:9200/pms/' ; echo
curl -XPUT 'http://localhost:9200/pms/' -d '{
"analysis" : {
"analyzer" : {
"auto_complete" : {
"type" : "custom",
"tokenizer" : "custom_edgeNGram",
"filter" : ["lowercase","custom_ngram"]
@dadoonet
dadoonet / test_locale.sh
Last active December 19, 2015 05:09 — forked from anonymous/gist:5900949
Test locale with multiple formats
curl -XPUT http://localhost:9200/test/ticket/_mappinq? -d '{
"ticket" : {
"properties" : {
"DOC_CREATION_DATE" : {
"type" : "date",
"format" : "yyyy-MM-dd || yyyy-MM-dd HH:mm:ss",
"locale" : "FR"
}
}
}
@dadoonet
dadoonet / nested.sh
Created June 26, 2013 16:25
Mapping not fully read
curl -XDELETE http://localhost:9200/test; echo
curl -XPUT http://localhost:9200/test; echo
curl -XPUT http://localhost:9200/test/ticket/_mapping -d '{
"ticket":{
"properties":{
"DOC_CREATION_DATE":{
"type":"date",
"format":"dateOptionalTime"
},
@dadoonet
dadoonet / start.sh
Last active December 18, 2015 16:49
Convert a nodes stats response (JSON Format) to a CSV representation for easier cluster overview Uses NodeJS
curl -XGET 'http://localhost:9200/_nodes/stats?all=true&pretty=true' > nodes.stats.json
node stats_converter.js
# Or
node stats_converter.js filename
@dadoonet
dadoonet / testdeleteandrecreate.sh
Created June 14, 2013 15:38
Testing delete and recreate issue
echo "clean index"
curl -XDELETE 'http://localhost:9200/test?pretty' ; echo
echo "PUT Tweet"
curl -XPUT 'http://localhost:9200/test/tweet/1?pretty' -d '
{
"myfield": "Hello world"
}
' ; echo
@dadoonet
dadoonet / deletebyquery.sh
Created May 15, 2013 19:55
Delete By Query usage
echo "clean index"
curl -XDELETE 'http://localhost:9200/twitter?pretty' ; echo
echo "PUT Tweet"
curl -XPUT 'http://localhost:9200/twitter/tweet/1?ttl=1h&pretty' -d '
{
"created_at": "Mon May 13 19:59:27 +0000 2013"
}
' ; echo
// app.js
angular.module('cs_demo', [
'controllers',
'elasticjs.service',
'ui.bootstrap'
]);
@dadoonet
dadoonet / mlt.sh
Created May 7, 2013 07:32
more like this (mlt) query with exact text on small dataset
# Delete the index `testindex`
curl -XDELETE 'http://localhost:9200/testindex'
# Create the index `testindex`
curl -XPUT 'http://localhost:9200/testindex' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}