From: Bill Erickson Date: Thu, 5 Sep 2019 15:52:47 +0000 (-0400) Subject: Updated example search in test script X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a500bd0a37aa1c18dea774ac4440253f93f4fca9;p=working%2FEvergreen.git Updated example search in test script Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/support-scripts/test-scripts/elastic-search.pl b/Open-ILS/src/support-scripts/test-scripts/elastic-search.pl index 2d9df68066..6562051d7b 100755 --- a/Open-ILS/src/support-scripts/test-scripts/elastic-search.pl +++ b/Open-ILS/src/support-scripts/test-scripts/elastic-search.pl @@ -18,16 +18,16 @@ GetOptions( 'help' => \$help, 'osrf-config=s' => \$osrf_config, 'cluster=s' => \$cluster, - 'index=s' => \$index, 'quiet' => \$quiet, - 'query-string=s' => \$query_string ) || die "\nSee --help for more\n"; sub help { print <import( IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL")); OpenILS::Utils::CStoreEditor::init(); +# Title search AND author search AND MARC tag=100 search my $query = { - _source => ['id'] , # return only the ID field + _source => ['id', 'title|proper'] , # return only the ID field from => 0, size => 5, sort => [ @@ -51,60 +52,39 @@ my $query = { ], query => { bool => { - must => { - query_string => { - default_operator => 'AND', - default_field => 'keyword', - query => $query_string + must => [{ + multi_match => { + query => 'ready', + fields => ['title|*.text*'], + operator => 'and', + type => 'most_fields' + } + }, { + multi_match => { + query => 'puzzle', + fields => ['subject|*.text*'], + operator => 'and', + type => 'most_fields' } - }, - filter => [ - #{term => {"subject|topic.raw" => "Piano music"}}, - { - nested => { - path => 'holdings', - query => { - bool => { - must => [ - { - bool => { - should => [ - {term => {'holdings.status' => '0'}}, - {term => {'holdings.status' => '7'}} - ] - } - }, - { - bool => { - should => [ - {term => {'holdings.circ_lib' => '4'}}, - {term => {'holdings.circ_lib' => '5'}} - ] - } - } - ] - } + }, { + nested => { + path => 'marc', + query => { + bool => { + must => [{ + multi_match => { + query => 'cline', + fields => ['marc.value.text*'], + operator => 'and', + type => 'most_fields' + } + }, { + term => {'marc.tag' => 100} + }] } } } - ] - } - }, - aggs => { - genres => { - terms => { - field => 'identifier|genre' - } - }, - 'author|corporate' => { - terms => { - field => 'author|corporate.raw' - } - }, - 'subject|topic' => { - terms => { - field => 'subject|topic.raw' - } + }] } } };