Skip to content

Instantly share code, notes, and snippets.

Created March 8, 2012 19:43
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 anonymous/2002929 to your computer and use it in GitHub Desktop.
Save anonymous/2002929 to your computer and use it in GitHub Desktop.
Elasticsearch url search
1) If pages index already exists delete it
curl -XDELETE http://localhost:9200/pages
1) Configure and create index
curl -XPUT http://localhost:9200/pages/ -d "
index :
analysis:
analyzer:
default_index:
filter: [standard, lowercase ]
tokenizer: uax_url_email
default_search:
tokenizer: uax_url_email
filter: [standard, lowercase]"
2) Configuration appears to be working as a single token is returned in each case
curl http://localhost:9200/pages/_analyze?text=http://elasticsearch.org
curl http://localhost:9200/pages/_analyze?text=kimchy@elasticsearch.org
3) Add searchable data
curl -XPUT localhost:9200/pages/page/1 -d '{
"content" : "use http://elasticsearch.org for search and email kimchy@elasticsearch.org for questions."
}'
4) Search for email returns result but url doesnot
curl http://localhost:9200/pages/_search?q=http://elasticsearch.org
curl http://localhost:9200/pages/_search?q=kimchy@elasticsearch.org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment