Hi,
At Go About we are using elasticsearch (0.90.2) for geocoding.
Unfortunately, I am running into a problem I could use some help with.
I use the following analyzer configuration:
index:
analysis:
analyzer:
default:
alias: [goabout]
type: custom
tokenizer: standard
filter: [lowercase, synonym, standard, asciifolding]
char_filter: [char_mapper]
postal_code:
tokenizer: keyword
filter: [lowercase]
tokenizer:
standard:
stopwords: []
filter:
synonym:
type: synonym
synonyms:
- st => sint
- den haag => s gravenhage
- den bosch => s hertogenbosch
- jp => jan pieterszoon
- mh => maarten harpertszoon
char_filter:
char_mapper:
type: mapping
mappings:
- ij => y
I then the index the following document:
$ curl -XPUT http://localhost:9200/geocoder/address/1 -d "{"city":
"'s-Gravenhage", "point": {"lat": 52.034608082483366, "lon":
4.266201580347966}, "street": "Wantsnijdersgaarde", "postal_code":
"2542 GN", "housenumber": "573"}"
(We put a mapping first to make sure "point" is a geo_point, but this is
not relevant for this problem.)
The analyzer seems to work correctly:
$ curl -X GET "http://localhost:9200/geocoder/_analyze?pretty=true" -d "Den
Haag"
{
"tokens" : [ {
"token" : "s",
"start_offset" : 0,
"end_offset" : 3,
"type" : "SYNONYM",
"position" : 1
}, {
"token" : "gravenhage",
"start_offset" : 4,
"end_offset" : 8,
"type" : "SYNONYM",
"position" : 2
} ]
}
The analyzer seems to get use in both indexing and querying, as this query
(that exchanges "y" for "ij") finds the document:
$ curl -X GET
"http://localhost:9200/geocoder/_search?q=Wantsnydersgaarde&analyzer=goabout&pretty=true"
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.095891505,
"hits" : [ {
"_index" : "geocoder",
"_type" : "address",
"_id" : "1",
"_score" : 0.095891505, "_source" : {"city": "'s-Gravenhage",
"point": {"lat": 52.034608082483366, "lon": 4.266201580347966}, "street":
"Wantsnijdersgaarde", "postal_code": "2542 GN", "housenumber": "573"}
} ]
}
}
But this search query does not return results:
$ curl -X GET
"http://localhost:9200/geocoder/_search?q=den+haag&analyzer=goabout&pretty=true"
{
"took" : 5,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
Something is going on with the synonym filter. What can I do to further
debug my problem?
Regards,
Joost
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.