Created
February 8, 2012 20:40
-
-
Save rickthomasjr/1773423 to your computer and use it in GitHub Desktop.
Faceting with commas and extra spaces
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 -XDELETE 'http://127.0.0.1:9200/foo/?pretty=1' | |
curl -XPUT 'http://127.0.0.1:9200/foo/?pretty=1' -d ' | |
{ | |
"settings" : { | |
"analysis" : { | |
"analyzer" : { | |
"comma" : { | |
"pattern" : "\\s*,\\s*", | |
"type" : "pattern" | |
} | |
} | |
} | |
} | |
} ' | |
curl -XPUT 'http://127.0.0.1:9200/foo/items/_mapping' -d '{"item":{"properties":{"category":{"type":"string","analyzer":"comma"}}}}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109970' -d '{"category": "foo bar"}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109971' -d '{"category": "foo bar "}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109972' -d '{"category": "foo bar "}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109973' -d '{"category": "foo bar, ding bar "}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109974' -d '{"category": "baz howdy hello "}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109975' -d '{"category": "baz howdy hello "}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109976' -d '{"category": "blah herp, foo bar"}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109977' -d '{"category": "blah herp, foo bar"}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109978' -d '{"category": "blah derp"}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/109979' -d '{"category": "blah herp "}' | |
curl -X POST 'http://127.0.0.1:9200/foo/items/_search?pretty=true' -d ' | |
{ | |
"query" : { "query_string" : {"query" : "*"} }, | |
"facets" : { | |
"tags" : { "terms" : {"field" : "category"} } | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment