C
C
cat_crash2014-12-15 11:48:36
elasticsearch
cat_crash, 2014-12-15 11:48:36

How to make a request to ElasticSearch?

There is an index, conditionally

{
"Name":"Масло машинное"
"attributes":{"Вязкость"=>"5w40","Для двигателей"=>"Дизель"}
"applicability":["BMW","AUDI","SEAT"] 
}

How to write a query correctly so that when querying "BMW Diesel Oil" this result is also given?
Now I use
"query_string"=>array (
                     "query"=>'Масло',
                     "default_operator"=>'or',
                     "allow_leading_wildcard"=>true,
                     "fields"=> array(
                      "Name^3",
                     )
                    ),
                    "constant_score"=>array(
                     "filter"=>array(
                      "terms"=>array(
                        "applicability"=>array('BMW')
                      )
                      )
                    )

But the result is given when querying "Oil", and when querying "BMW Oil", an empty result is returned.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question