mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 20:08:56 +00:00
Most query parsers throw a ParsingException when they trying to parse a field with an unknown name. This adds a generic check for this to the AbstractQueryTestCase so the behaviour gets tested for all query parsers. The test works by first making sure the test query has a `boost` field and then changing this to an unknown field name and checking for an error. There are exceptions to this for WrapperQueryBuilder and QueryFilterBuilder, because here the parser only expects the wrapped `query` element. MatchNoneQueryBuilder and MatchAllQueryBuilder so far had setters for boost() and queryName() but didn't render them, which is added here for consistency. GeoDistance, GeoDistanceRange and GeoHashCellQuery so far treat unknown field names in the json as the target field name of the center point of the query, which so far was handled by overwriting points previously specified in the query. This is changed here so that an attempt to use two different field names to specify the central point of the query throws a ParsingException Relates to #10974