Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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