M
M
My joy2020-12-30 15:51:58
elasticsearch
My joy, 2020-12-30 15:51:58

Search across multiple fields?

Hi friends!
Help the teapot. There is a search form for ads, it contains the parameters "object price", "available for resale" (checkbox), and so on. in general, the usual form of advanced search with 20 fields.
I want to display a counter under the form so that it shows how many ads were found (even before pressing the "find" button.
I don't understand how to search in the eraser for several fields at once.

$params = [
      'index' => 'ads',
      'default_operator' => 'AND',
      'body'  => [
        'query' => [
          'terms' => [
            'visible' => '1',
            'price' => 555,
          ]
        ]
      ]
    ];

gives an eraser error:
[terms] query does not support [price]
if I comment out price and leave visible , it will swear at it. how do i make mysql analog of search "a = b AND c = d AND e = f ..." ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
My joy, 2020-01-02
@t-alexashka

Here is what helped me understand the query structure:
https://sqltoelasticsearch.azurewebsites.net/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question