in reply to Queries for elastic search using perl

What do you mean by "But missing some where"?

Also note that there is Search::Elasticsearch, which is a module geared towards talking to Elasticsearch.

  • Comment on Re: Queries for elastic search using perl

Replies are listed 'Best First'.
Re^2: Queries for elastic search using perl
by ravi45722 (Pilgrim) on Jun 29, 2016 at 04:29 UTC

    I know the module. But I am preparing the queries for the elastic search.

     ((column08=Submit & column10=Delivered & column09=Something) | (column08=Delivered))

    This is the condition I am getting from GUI. I have to query the elastic search and return the result to the GUI through perl. For Quering we need to parse the condition in the form of elastic search query.

    Whats my problem here is in my code (Mentioned in the main thread) 1) I am passing the inner braces to the function first

     column08=Submit & column10=Delivered & column09=Something

    2) In line 58 I am giving my array to a hash

     $return_hash{'bool'}{'must'} = [@return_array];

    I expected the output as

    $VAR1 = ['bool' => { 'must' => [ { 'term' => { 'column08' => 'Submit' } }, { 'term' => { 'column10' => 'Delivered' } }, { 'term' => { 'column09' => 'Something' } } ] } ]

    But Its returning it as

    $VAR1 = [ 'bool', { 'must' => [ { 'term' => { 'column08' => 'Submit' } }, { 'term' => { 'column10' => 'Delivered' } }, { 'term' => { 'column09' => 'Something' } } ] } ];

      Where do the two data structures differ?

        Near the bool. Its pushing as a element. Means the array contains two elements bool & the hash. But I expected that as a whole(one) hash.