Skip to content

Instantly share code, notes, and snippets.

Created March 1, 2011 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/849684 to your computer and use it in GitHub Desktop.
Save anonymous/849684 to your computer and use it in GitHub Desktop.
ElasticSearch with stemming
metadata: {
templates: { }
indices: {
test_index: {
state: open
settings: {
index.analysis.filter.snowball.language: English
index.analysis.analyzer.search_analyzer.filter.0: lowercase
index.analysis.analyzer.search_analyzer.filter.1: snowball
index.analysis.analyzer.index_analyzer.filter.0: lowercase
index.analysis.filter.snowball.type: snowball
index.analysis.analyzer.search_analyzer.tokenizer: nGram
index.analysis.analyzer.index_analyzer.tokenizer: nGram
index.analysis.analyzer.index_analyzer.filter.1: snowball
index.number_of_shards: 5
index.number_of_replicas: 1
}
mappings: {
test_item: {
properties: {
title: {
store: yes
analyzer: standard
term_vector: with_positions_offsets
type: string
}
description: {
store: yes
analyzer: standard
term_vector: with_positions_offsets
type: string
}
link: {
type: string
}
}
}
}
aliases: [ ]
}
}
}
curl -XGET 'http://localhost:9200/_search?pretty=true' -d '
{
"highlight": {
"tags_schema": "styled",
"fields": {
"title": {
"number_of_fragments": 0
},
"description": {
"number_of_fragments": 0
}
}
},
"query": {
"query_string": {
"fields" : ["title", "description"],
"query" : "apple" /* finds entries with "apple", a search with "apples" doesn't work */
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment