Last active
August 29, 2015 14:02
-
-
Save drewr/13ba55295f4430d076d2 to your computer and use it in GitHub Desktop.
Bool filter with whitespace analyzer
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
curl -s -XDELETE localhost:9200/damjan >/dev/null | |
curl -s -XPUT localhost:9200/damjan -d'--- | |
settings: | |
index.number_of_shards: 1 | |
index.number_of_replicas: 0 | |
mappings: | |
t: | |
properties: | |
appname: | |
type: string | |
analyzer: whitespace | |
' | |
curl -s localhost:9200/damjan/_analyze\?format=yaml\&field=appname\&text=api-v2 | |
curl -s -XPOST localhost:9200/damjan/t\?refresh -d'--- | |
appname: api | |
' | |
curl -s -XPOST localhost:9200/damjan/t\?refresh -d'--- | |
appname: api-v2 | |
' | |
curl -s localhost:9200/damjan/_search -d'--- | |
query: | |
filtered: | |
query: | |
match_all: {} | |
filter: | |
bool: | |
must: | |
term: | |
appname: api | |
must_not: | |
term: | |
appname: api-v2 | |
' | |
# alternatively (with potentially more memory consumption) | |
curl -s localhost:9200/damjan/_search -d'--- | |
query: | |
filtered: | |
query: | |
match_all: {} | |
filter: | |
regexp: | |
appname: "api" | |
' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment