Created
November 21, 2011 16:31
-
-
Save alrouen/1383146 to your computer and use it in GitHub Desktop.
Query string analyzer not used when specified with ElasticSearch version 0.18.4
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
- MacOS X 10.7.2 | |
- JVM: | |
java version "1.6.0_29" | |
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11M3527) | |
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode) | |
Local configuration : | |
------ | |
elasticsearch.yml | |
index: | |
analysis: | |
analyzer: | |
en: | |
type: custom | |
tokenizer: std_tokenizer | |
filter: [standard, lowercase, stop_en, stem_english] | |
char_filter: html_strip | |
fr: | |
type: custom | |
tokenizer: std_tokenizer | |
filter: [standard, elision, lowercase, stop_fr, stem_french] | |
char_filter: html_strip | |
de: | |
type: custom | |
tokenizer: std_tokenizer | |
filter: [standard, lowercase, stop_de, stem_german] | |
char_filter: html_strip | |
tokenizer: | |
std_tokenizer: | |
type: standard | |
max_token_length: 1024 | |
filter: | |
decompounder_de: | |
type: dictionary_decompounder | |
word_list_path: /usr/local/elasticsearch/config/de_DE.dic | |
stem_german: | |
type: snowball | |
language: German2 | |
stem_french: | |
type: stemmer | |
language: french | |
stem_light_french: | |
type: stemmer | |
language: light_french | |
stem_english: | |
type: snowball | |
language: English | |
stop_en_fr_de: | |
type: stop | |
stopwords: [_english_, _french_, _german_] | |
stop_en: | |
type: stop | |
stop_fr: | |
type: stop | |
stopwords: [_french_] | |
stop_de: | |
type: stop | |
stopwords: [_german_] | |
elision: | |
type : elision | |
articles : [l, m, t, qu, n, s, j] | |
Mapping config/mappings/_default/news.json : | |
{ | |
"news" : { | |
"_analyzer" : { | |
"path" : "site" | |
}, | |
"properties" : { | |
"title": { | |
"type":"string", | |
"index": "analyzed", | |
"store": "yes" | |
}, | |
"body": { | |
"type":"string", | |
"index": "analyzed", | |
"store": "no" | |
}, | |
"section": { | |
"type":"string", | |
"index": "not_analyzed", | |
"store": "no" | |
}, | |
"site": { | |
"type":"string", | |
"index": "not_analyzed", | |
"store": "no" | |
}, | |
"updatedOn": { | |
"type":"date", | |
"store": "no" | |
} | |
} | |
} | |
} | |
------ | |
------ To reproduce the issue : ------ | |
###### 0.18.4 ######## | |
curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true' | |
{ | |
"cluster_name" : "elasticsearch", | |
"status" : "yellow", | |
"timed_out" : false, | |
"number_of_nodes" : 1, | |
"number_of_data_nodes" : 1, | |
"active_primary_shards" : 5, | |
"active_shards" : 5, | |
"relocating_shards" : 0, | |
"initializing_shards" : 0, | |
"unassigned_shards" : 5 | |
} | |
curl -XGET 'http://localhost:9200/myindex/news/_mapping?pretty=true' | |
{ | |
"news" : { | |
"_analyzer" : { | |
"path" : "site" | |
}, | |
"properties" : { | |
"site" : { | |
"index" : "not_analyzed", | |
"type" : "string" | |
}, | |
"body" : { | |
"type" : "string" | |
}, | |
"title" : { | |
"store" : "yes", | |
"type" : "string" | |
}, | |
"updatedOn" : { | |
"format" : "dateOptionalTime", | |
"type" : "date" | |
}, | |
"section" : { | |
"index" : "not_analyzed", | |
"type" : "string" | |
} | |
} | |
} | |
} | |
curl -XPUT 'http://127.0.0.1:9200/myindex/news/1' -d ' | |
{ "title" : "accidents sur la route", | |
"body" : "accidents sur la route", | |
"site" : "fr", | |
"section" : "divers" | |
}' | |
{"ok":true,"_index":"myindex","_type":"news","_id":"1","_version":1} | |
curl -XGET 'http://localhost:9200/myindex/news/_search?pretty=true' -d ' | |
{ "query" : | |
{ "query_string":{"query":"accidents","analyzer":"fr"} } | |
}' | |
{ | |
"took" : 1, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 1, | |
"max_score" : 0.095891505, | |
"hits" : [ { | |
"_index" : "myindex", | |
"_type" : "news", | |
"_id" : "1", | |
"_score" : 0.095891505, "_source" : | |
{ "title" : "accidents sur la route", | |
"body" : "accidents sur la route", | |
"site" : "fr", | |
"section" : "divers" | |
} | |
} ] | |
} | |
} | |
curl -XGET 'http://localhost:9200/myindex/news/_search?pretty=true' -d ' | |
{ "query" : | |
{ "query_string":{"query":"accident","analyzer":"fr"} } | |
}' | |
{ | |
"took" : 0, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 0, | |
"max_score" : null, | |
"hits" : [ ] | |
} | |
} | |
---- | |
###### 0.17.4 ######## | |
curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true' | |
{ | |
"cluster_name" : "elasticsearch", | |
"status" : "yellow", | |
"timed_out" : false, | |
"number_of_nodes" : 1, | |
"number_of_data_nodes" : 1, | |
"active_primary_shards" : 5, | |
"active_shards" : 5, | |
"relocating_shards" : 0, | |
"initializing_shards" : 0, | |
"unassigned_shards" : 5 | |
} | |
curl -XGET 'http://localhost:9200/myindex/news/_mapping?pretty=true' | |
{ | |
"news" : { | |
"_analyzer" : { | |
"path" : "site" | |
}, | |
"properties" : { | |
"site" : { | |
"index" : "not_analyzed", | |
"type" : "string" | |
}, | |
"body" : { | |
"type" : "string" | |
}, | |
"title" : { | |
"store" : "yes", | |
"type" : "string" | |
}, | |
"updatedOn" : { | |
"format" : "dateOptionalTime", | |
"type" : "date" | |
}, | |
"section" : { | |
"index" : "not_analyzed", | |
"type" : "string" | |
} | |
} | |
} | |
} | |
curl -XPUT 'http://127.0.0.1:9200/myindex/news/1' -d ' | |
> { "title" : "accidents sur la route", | |
> "body" : "accidents sur la route", | |
> "site" : "fr", | |
> "section" : "divers" | |
> }' | |
{"ok":true,"_index":"myindex","_type":"news","_id":"1","_version":1} | |
curl -XGET 'http://localhost:9200/myindex/news/_search?pretty=true' -d ' | |
{ "query" : | |
{ "query_string":{"query":"accidents","analyzer":"fr"} } | |
}' | |
{ | |
"took" : 0, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 1, | |
"max_score" : 0.11506981, | |
"hits" : [ { | |
"_index" : "myindex", | |
"_type" : "news", | |
"_id" : "1", | |
"_score" : 0.11506981, "_source" : | |
{ "title" : "accidents sur la route", | |
"body" : "accidents sur la route", | |
"site" : "fr", | |
"section" : "divers" | |
} | |
} ] | |
} | |
} | |
curl -XGET 'http://localhost:9200/myindex/news/_search?pretty=true' -d ' | |
{ "query" : | |
{ "query_string":{"query":"accidentés","analyzer":"fr"} } | |
}' | |
{ | |
"took" : 1, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 1, | |
"max_score" : 0.11506981, | |
"hits" : [ { | |
"_index" : "myindex", | |
"_type" : "news", | |
"_id" : "1", | |
"_score" : 0.11506981, "_source" : | |
{ "title" : "accidents sur la route", | |
"body" : "accidents sur la route", | |
"site" : "fr", | |
"section" : "divers" | |
} | |
} ] | |
} | |
} | |
curl -XGET 'http://localhost:9200/myindex/news/_search?pretty=true' -d ' | |
{ "query" : | |
{ "query_string":{"query":"accident","analyzer":"fr"} } | |
}' | |
{ | |
"took" : 0, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 1, | |
"max_score" : 0.11506981, | |
"hits" : [ { | |
"_index" : "myindex", | |
"_type" : "news", | |
"_id" : "1", | |
"_score" : 0.11506981, "_source" : | |
{ "title" : "accidents sur la route", | |
"body" : "accidents sur la route", | |
"site" : "fr", | |
"section" : "divers" | |
} | |
} ] | |
} | |
} | |
-------------------------------------- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment