Skip to content

Instantly share code, notes, and snippets.

@mattweber
Created February 15, 2012 18:54
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 mattweber/1838124 to your computer and use it in GitHub Desktop.
Save mattweber/1838124 to your computer and use it in GitHub Desktop.
index:
analysis:
analyzer:
string_lowercase:
tokenizer: keyword
filter: lowercase
# does not work
curl -XGET 'http://localhost:9200/test/type1/_search?pretty=true' -d '{
"query":{
"field":{
"field1":{
"query":"matt weber"
}
}
}
}'
# does not work
curl -XGET 'http://localhost:9200/test/type1/_search?pretty=true' -d '{
"query":{
"field":{
"field1":{
"query":"matt weber",
"analyzer":"string_lowercase"
}
}
}
}'
curl -XPUT 'http://localhost:9200/test' -d '{
"mappings" : {
"type1" : {
"properties" : {
"field1" : {
"type" : "string",
"analyzer" : "string_lowercase"
}
}
}
}
}'
# does not work
curl -XGET 'http://localhost:9200/test/type1/_search?pretty=true' -d '{
"query":{
"query_string":{
"query":"matt weber",
"fields":["field1"]
}
}
}'
# does not work
curl -XGET 'http://localhost:9200/test/type1/_search?pretty=true' -d '{
"query":{
"query_string":{
"query":"matt weber",
"fields":["field1"],
"analyzer":"string_lowercase"
}
}
}'
curl -XPUT 'http://localhost:9200/test/type1/1' -d '{"field1":"Matt Weber"}'
# works with and without specifying the analyzer
curl -XGET 'http://localhost:9200/test/type1/_search?pretty=true' -d '{
"query":{
"text":{
"field1":{
"query":"matt weber"
}
}
}
}'
@kimchy
Copy link

kimchy commented Feb 15, 2012

curl -XGET 'http://localhost:9200/test/type1/_search?pretty=true' -d '{
    "query":{
        "query_string":{
            "query":"\"matt weber\"",
            "fields":["field1"]
        }
    }
}'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment