c# - Searching across multiple address fields in Elasticsearch -
i have address saved in elasticsearch document in form of:
"address": { "streetaddress": "123 fake street", "city": "san francisco", "region": "california", "postalcode": "94111", "country": "united states" }, how can search index using input string may contain data each of different fields. example user may search "123 fake street, san francisco" - or without comma.
would make sense tokenize search string , search each word against each of fields in questions? or somehow concatenate of 5 fields separate address field , search on that? we're using ngrams of size 2 - 12.
i had question asked here phone numbers concatenated of phone number elements 1 new field: searching phone number object in elasticsearch c#
but address situation different in how uses may search documents.
if plan on sticking elastic 5 while, _all field should satisfy requirements.
as @paige cook pointed out in comments above, _all field disabled default in elastic 6, no way of enabling on newly created indices in version. will, however, stay enabled on indices created in version 5.
if read section _all field in breaking changes documentation listed above, you'll see references query_string , simple_query_string methods (both available through nest library part of http api elastic provides) both of continue searching across fields, though _all field disabled.
hopefully 1 of these can solve issue facing.
Comments
Post a Comment