-
-
Save markharwood/d94f8c4c1a167297b3dd to your computer and use it in GitHub Desktop.
Numeric queries can't make use of norms.
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
DELETE users | |
POST /users | |
{ | |
"settings" : { | |
"number_of_shards" : 1, | |
"number_of_replicas" : 0 | |
}, | |
"mappings":{ | |
"user": { | |
"properties": { | |
"likes_as_nums" : { | |
"index" : "not_analyzed", | |
"omit_norms" : false, | |
"type" : "integer" | |
}, | |
"likes_as_strings" : { | |
"index" : "not_analyzed", | |
"omit_norms" : false, | |
"type" : "string" | |
} | |
} | |
} | |
} | |
} | |
PUT users/user/1 | |
{ | |
"likes_as_strings":["1","2","3","4","5","6"], | |
"likes_as_nums": [1,2,3,4,5] | |
} | |
PUT users/user/2 | |
{ | |
"likes_as_strings":["1","2"], | |
"likes_as_nums": [1,2] | |
} |
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
POST users/user/_search?explain=true | |
{ | |
"query": { | |
"bool": { | |
"should": [ | |
{ | |
"match": { | |
"likes_as_nums": 1 | |
} | |
}, | |
{ | |
"match": { | |
"likes_as_nums": 2 | |
} | |
} | |
] | |
} | |
}, | |
"size": 1 | |
} | |
POST users/user/_search?explain=true | |
{ | |
"query":{ | |
"terms":{ | |
"likes_as_nums":[1,2] | |
} | |
}, | |
"size":1 | |
} | |
POST users/user/_search?explain=true | |
{ | |
"query":{ | |
"query_string":{ | |
"query":"likes_as_nums:(1 2)" | |
} | |
}, | |
"size":1 | |
} |
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
POST users/user/_search?explain=true | |
{ | |
"query":{ | |
"query_string":{ | |
"query":"likes_as_strings:(1 2)" | |
} | |
}, | |
"size":1 | |
} | |
POST users/user/_search?explain=true | |
{ | |
"query":{ | |
"terms":{ | |
"likes_as_strings":[1, 2] | |
} | |
}, | |
"size":1 | |
} | |
POST users/user/_search?explain=true | |
{ | |
"query": { | |
"bool": { | |
"should": [ | |
{ | |
"match": { | |
"likes_as_strings": "1" | |
} | |
}, | |
{ | |
"match": { | |
"likes_as_strings": "2" | |
} | |
} | |
] | |
} | |
}, | |
"size": 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment