I want to use elastic search to search a large database of addresses, and to make it look like some other applications, I start with a zip code that is great for the rest of the search query.
So Search :: Elasticsearch
I do
my $scroll = $e->scroll_helper(index => 'pdb', search_type => 'scan', size => 100, body => { query => { bool => { filter => [ {match => { pcode => $postcode }}, ], should => [ {match => { address => $keyword }}, {match => { name => $keyword }}, ], } } } );
However, it just spits out everything for $postcode and regardless of the fact that $keyword - this result is not reduced.
I need to have $postcode as a prerequisite, but also separately and, in addition, the other two fields should also be taken into account as a full-text search. How do I do this (I look at the docs and can interpret json-> perl hashrefs incorrectly, so any suggestions are welcome)
For a hypothetical example: The user enters NW1 4AQ . The above query will immediately return to, say, Albany Street and Portland Street, if the user requests Portland and this postcode, instead of receiving both of these results, I expect that the result will be only Portland Street. Right now with the above. He just keeps returning both records.
perl elasticsearch
Recct
source share