Skip to content

Instantly share code, notes, and snippets.

View mukulgupta2507's full-sized avatar

Mukul Gupta mukulgupta2507

View GitHub Profile
@mukulgupta2507
mukulgupta2507 / query_string.sh
Created July 13, 2014 14:57
Query_string for using full text search in autocompleter
curl -XGET 'localhost:9200/booksindex/booksidx/_search?pretty=true' -d '{
"query": {
"query_string": {
"query": "mastering by marek",
"fields": [
"title.title_shingles^2",
"author.author_shingles"
]
}
}
@mukulgupta2507
mukulgupta2507 / exact_match.sh
Created July 13, 2014 14:56
Quering for exact match in autocompleter
curl -XGET 'localhost:9200/booksindex/booksidx/_search?pretty=true' -d '{
"query": {
"match": {
"title" : "elasticsearch"
}
}
}'
@mukulgupta2507
mukulgupta2507 / sample_data.sh
Created July 13, 2014 14:55
Sample data for indexing and searching autocompleter
{
"_id": ObjectId("53c2890368103fc09aa86632"),
"title": "ElasticSearch The Definitve Guide",
"isbn": "9781449358549",
"author": "Clinton Gormley",
"category": "Technology",
"rating": 4
}
{
@mukulgupta2507
mukulgupta2507 / mapping.sh
Created July 13, 2014 14:52
Full text Autocompleter using ElasticSearch
curl -XPUT 'http://localhost:9200/booksindex' -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 1,
"analysis" : {
"analyzer" : {
"str_search_analyzer_1" : {
"tokenizer" : "keyword",
"filter" : ["lowercase","asciifolding"]