-
-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Description
From what I can tell, it's not possible to perform a nested query inside of a filter context with BodyBuilder:
bodybuilder().orFilter('nested', 'path', 'my_path', b =>
b.query('term', 'my_path.my_field', 'my_value')
)This doesn't work because b.query does not exist, and instead only various filter functions are available. I believe this has to do with being in the "filter context" because of the outer orFilter().
If I try to use filter, however:
bodybuilder().orFilter('nested', 'path', 'my_path', b =>
b.filter('term', 'my_path.my_field', 'my_value')
)This results in a 400 Bad Request from Elasticsearch because filters inside of a nested field is not supported. I am running against Elasticsearch v6.2.
If I use an orQuery at the top-level this works fine:
bodybuilder().orQuery('nested', 'path', 'my_path', b =>
b.query('term', 'my_path.my_field', 'my_value')
)However this doesn't work for me because I want my boolean condition to live in the filter context with my other conditions and it's cheaper to perform.
Metadata
Metadata
Assignees
Labels
No labels