Skip to content

Instantly share code, notes, and snippets.

@eskibars
Created October 28, 2016 13:10
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 eskibars/2a1e91454eb4fc4a88860cc80ea09acd to your computer and use it in GitHub Desktop.
Save eskibars/2a1e91454eb4fc4a88860cc80ea09acd to your computer and use it in GitHub Desktop.
Not analyzed example
// Add our mapping for type "type_name" to index "t"
PUT t
{
"mappings": {
"type_name" : {
"dynamic_templates": [{
"notanalyzed" : {
"match": "*",
"mapping": {
"index": "not_analyzed"
}
}
}]
}
}
}
// Add a document to index "t" and type "type_name"
PUT t/type_name/1
{
"baz": "foo bar"
}
// This produces 0 results
GET t/_search
{
"query": {
"match": {
"baz": "bar"
}
}
}
// This produces 1 result
GET t/_search
{
"query": {
"match": {
"baz": "foo bar"
}
}
}
// This produces 1 result as well
GET t/_search
{
"query": {
"term": {
"baz": "foo bar"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment