Skip to content

Instantly share code, notes, and snippets.

View imotov's full-sized avatar

Igor Motov imotov

View GitHub Profile
curl -XDELETE 'http://localhost:9200/test-idx'
echo
curl -XPUT 'http://localhost:9200/test-idx' -d '{
"mappings" : {
"document" : {
"properties" : {
"tags" : {
"type" : "nested",
"properties" : {
"tag" : { "type" : "string", "index": "not_analyzed" },
curl -XDELETE 'http://localhost:9200/test-idx'
echo
curl -XPUT 'http://localhost:9200/test-idx'
echo
echo
echo "**** Standard analyzer ****"
curl 'http://localhost:9200/test-idx/_analyze?pretty=true' -d 'This is a test of vamsikrishna@gmail.com'
echo
curl -XDELETE 'http://localhost:9200/test-idx'
echo
#!/bin/sh
curl -XDELETE localhost:9200/names
curl -XPUT localhost:9200/names -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
},
"mappings" : {
curl -XDELETE 'http://localhost:9200/test-idx'
echo
curl -XPUT 'http://localhost:9200/test-idx' -d '{
"mappings" : {
"type1" : {
"properties" : {
"obj1" : {
"type" : "nested"
}
}
curl -XDELETE 'http://localhost:9200/test-idx'
echo
echo "Creating parent mappings"
curl -XPUT 'http://localhost:9200/test-idx' -d '
{
"settings": {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
@imotov
imotov / gist:3973641
Created October 29, 2012 13:46
Sorting mixed integer/string field
curl -XDELETE 'http://localhost:9200/test-idx'
echo
curl -XPUT 'http://localhost:9200/test-idx' -d '
{
"mappings": {
"doc": {
"properties" : {
"mixed" : {"type": "string", "store": "yes"}
}
}
@imotov
imotov / has-child-on-contact.sh
Created September 25, 2012 21:50 — forked from andreasch/has-child-on-contact.sh
Querying a parent type that is also a child type for another type
#!/bin/bash
echo "Performing a has_child search on contacts"
curl -XGET 'http://localhost:9200/contact/_search?pretty=true' -d '
{
"query" : {
"filtered" : {
"query" : {
"match_all" : { }
},
"filter" : {
#!/bin/sh
# Delete old version to make sure new settings are applied
curl -XDELETE "localhost:9200/prefix-test/"
echo
# Create a new index with custom path_hierarchy analyzer
# See http://www.elasticsearch.org/guide/reference/index-modules/analysis/pathhierarchy-tokenizer.html
curl -XPUT "localhost:9200/prefix-test" -d '{
"settings": {
"analysis": {
"analyzer": {
@imotov
imotov / doubleid.sh
Created August 10, 2012 01:17
Repro for double id problem
#!/bin/sh
curl -XDELETE "http://localhost:9200/test"
curl -XPUT "http://localhost:9200/test" -d '{
"mappings" : {
"rec" : {
"_id" : {"store" : "yes"}
}
}
}'
curl -XPUT "http://localhost:9200/test/rec/1" -d '{
@imotov
imotov / demo.sh
Created August 7, 2012 00:46
elasticsearch 0.20.0.Beta1-SNAPSHOT highlighting
#!/bin/sh
curl -XDELETE http://localhost:9200/test-idx && echo
curl -XPUT http://localhost:9200/test-idx -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"analysis": {
"analyzer" : {
"standard_no_pos" : {