Created
November 1, 2012 14:22
-
-
Save imotov/3993902 to your computer and use it in GitHub Desktop.
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 -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 | |
echo | |
echo "**** Email analyzer ****" | |
curl -XPUT 'http://localhost:9200/test-idx' -d '{ | |
"settings" : { | |
"index": { | |
"analysis" :{ | |
"analyzer": { | |
"default": { | |
"type" : "custom", | |
"tokenizer" : "uax_url_email", | |
"filter" : ["standard", "lowercase", "stop"] | |
} | |
} | |
} | |
} | |
} | |
} | |
' | |
echo | |
curl 'http://localhost:9200/test-idx/_analyze?pretty=true' -d 'This is a test of vamsikrishna@gmail.com' | |
echo | |
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 -XDELETE 'http://localhost:9200/test-idx' | |
echo | |
curl -XPUT 'http://localhost:9200/test-idx' -d '{ | |
"mappings" : { | |
"doc" : { | |
"properties" : { | |
"name" : {"type": "string", "index": "analyzed"}, | |
"email" : {"type": "string", "index": "not_analyzed", "include_in_all": false} | |
} | |
} | |
} | |
} | |
' | |
echo | |
curl -XPUT localhost:9200/test-idx/doc/1 -d '{ | |
"name": "Elastic Search", | |
"email": "search@elasticsearch.org" | |
}' | |
echo | |
curl -XPUT localhost:9200/test-idx/doc/2 -d '{ | |
"name": "Lucene", | |
"email": "search@apache.org" | |
}' | |
echo | |
curl -XPOST localhost:9200/test-idx/_refresh | |
curl 'http://localhost:9200/test-idx/_search?pretty=true' -d '{ | |
"query" : { | |
"query_string" : { | |
"query" : "search", | |
"fields" : ["_all", "email"] | |
} | |
} | |
}' | |
echo | |
curl 'http://localhost:9200/test-idx/_search?pretty=true' -d '{ | |
"query" : { | |
"query_string" : { | |
"query" : "search@apache.org", | |
"default_operator": "AND", | |
"fields" : ["_all", "email"] | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment