Skip to content

Instantly share code, notes, and snippets.

@sbrauer
Created December 14, 2011 20:05
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 sbrauer/1478233 to your computer and use it in GitHub Desktop.
Save sbrauer/1478233 to your computer and use it in GitHub Desktop.
trying to use standard_html_strip in ElasticSearch
$ curl -XPUT http://localhost:9200/foo
{"ok":true,"acknowledged":true}
$ curl -XPUT http://localhost:9200/foo/bar/_mapping -d '{
"properties" : {
"body": {"type":"string", "analyzer":"standard_html_strip"}
}
}'
{"ok":true,"acknowledged":true}
$ curl -XPUT http://localhost:9200/foo/bar/1 -d '{
"body": "<p>This is a <strong>test</strong>.</p>"
}'
{"ok":true,"_index":"foo","_type":"bar","_id":"1","_version":1}
$ curl -XGET http://localhost:9200/foo/bar/_search?q=body:strong
{"took":35,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":1,"max_score":0.18985549,"hits":[{"_index":"foo","_type":"bar","_id":"1","_score":0.18985549, "_source" : {
"body": "<p>This is a <strong>test</strong>.</p>"
}}]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment