Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying by multiple form fields filter #34

Open
florentsorel opened this issue Jul 3, 2015 · 0 comments
Open

Querying by multiple form fields filter #34

florentsorel opened this issue Jul 3, 2015 · 0 comments

Comments

@florentsorel
Copy link

Hi,

I'm new with Elastic. I would like to search by multiple form fields.

For example I have my form with: company_name, contacts.first_last_name.

In my Elastic structure I have company_name, contacts.firstname, contacts.lastname

I want search by name (concat firstname and lastname) but if I filled the company_name form field I want to search company_name AND firstname + lastname

I think it's working with concat field, but who to add other field ?

$clients = Client::searchByQuery([
    'multi_match' => [
        'query' => $request->get('first_last_name'),
        "type" => "cross_fields",
        'operator' => 'and',
        'fields' => [
            'contacts.firstname',
            'contacts.lastname',
        ]

    ]
]);

Btw, how to add some checkboxes to the query with Elasticquent ? Of course, firstname, lastname and company_name will be included in the query too. I think it's a complex filter :/

Thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant