I'm trying to learn Elastic Search with help of php composer package. I'm having a index with the name of media_data which contains nits_account, nits_url, session_id, timestamp fields. I want to have filters based on above fields and it should be in and operator. my current query code is:
$items = $this->elasticsearch->search([
    'index' => $index_name,
    'body'  => [
        'query' => [
            'filtered' => [
                'filter' => [
                    'and' => [
                        ['match' => ['nits_account' => 'xyzABCD2190-aldsj']],  //API Key
                        ['match' => ['nits_url' => 'google.com']],
                    ]
                ]
            ]
        ]
    ]
]);
My question:
- I'm unable to fetch data. But if I do below code: - $items = $this->elasticsearch->search([ 'index' => $index_name, 'body' => [ 'query' => [ 'bool' => [ 'should' => [ ['match' => ['nits_account' => $account] ], ['match' => ['nits_url' => $domain] ], ], ], ] ] ]);
I get values in or operators, but need to have and operation in it.
- How can I have different search operations with respective fields, I mean I want to have nits_accountfield to be exact match, I want to havenits_urlwith like/wildcard operations, timestamp should be comparable (greater than/less than/between two dates).
 
    