Hello,
I've searched a lot around this forum and google but I didn't find a proper way to index URL that would also allow partial match.
My use case is, I have documents that contains fully qualified URL (hostname + path + query string), I want to them to be searchable, either exact match or partial match.
I've put a keyword
mapping right now because I don't want my URL to split in multiple keyword.
# Mapping
{
"mappings": {
"properties": {
"url": {
"type": "keyword"
}
}
}
}
# Document example
{
"_source": {
"url": "https://discuss.elastic.co/t/indexing-and-searching-urls-with-dashes/6977?foo=bar"
}
}
Let say I have this URL: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html?pid=1234
.
I want to find it when I type:
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html?pid=1234
www.elastic.co
elasticsearch/reference/current
pid
- [anything really ...]
The problem I have, is that ngram would be too big to generate (I think), wildcard is working but I suppose it's slow.
Is there a good solution to this ?
Thanks,