Skip to content

Instantly share code, notes, and snippets.

@fredv
Created July 23, 2014 09:22
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 fredv/503a5a64946cfee0bc9e to your computer and use it in GitHub Desktop.
Save fredv/503a5a64946cfee0bc9e to your computer and use it in GitHub Desktop.
ElasticSearch query_string parsing quotes on not_analyzed field vs. standard tokenizer
PUT http://localhost:9200/_template/txt
{
"template": "index_dev",
"order": 0,
"mappings": {
"_default_": {
"dynamic_templates": [
{
"template_txt": {
"mapping": {
"index": "not_analyzed",
"type": "string"
},
"match_mapping_type": "string",
"match": "*_txt"
}
}
]
}
}
}
DELETE http://localhost:9200/index_dev
POST http://localhost:9200/index_dev/1
{
"content_test_txt": "this is the volume, offered",
"content_test": "this is the volume, offered"
}
GET http://localhost:9200/index_dev/_mapping
GET http://localhost:9200/index_dev/_validate/query?explain
{
"query": {
"query_string": {
"query": "content_test_txt:(\"volume, offered\")"
}
}
}
GET http://localhost:9200/index_dev/_validate/query?explain
{
"query": {
"query_string": {
"query": "content_test:(\"volume, offered\")"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment