Function Score (gauss) on multiple indexes "unknown field" error

On ElasticSearch 5.6

I'm running a multi-index query that uses the gauss function to score the resulting documents. The problem is that my indexes have different structures, so the geo_points are in slightly different fields/paths.

On the first index, the geo_point is in "locations.addresses.lat_lon" (locations is a nested type, and addresses is just an object). On the second index, the geo_point is in "addresses.lat_lon" (addresses is a nested type - now that I think about it, I'm not sure why I did it that way).

As far as I can tell, there's no way to use something like "ignore_unmapped" for function_score or gauss queries. Do I have to change the structure of my second index? Or is there some way I can create aliases or something to allow the gauss function to get the right fields?

Hey,

your best bet would be to reindex your data here. Also upgrading might be an option, as since Elasticsearch 6.4 (IIRC) there is a feature called field aliases, see https://www.elastic.co/guide/en/elasticsearch/reference/7.2/alias.html

--Alex

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.