Search on multiple fields with ElasticSearch with or, and operators Search on multiple fields with ElasticSearch with or, and operators elasticsearch elasticsearch

Search on multiple fields with ElasticSearch with or, and operators


I`m solve this problem. In ElasticSearch there is such a great feature as function_score:

{  "query": {    "bool": {      "must": [        {          "function_score": {            "query": {              "bool": {                "should": [                  {                    "fuzzy": {                      "model_name": "word1"                    }                  },                  {                    "fuzzy": {                      "product_name": "word1"                    }                  }                ]              }            }          }        },        {          "function_score": {            "query": {              "bool": {                "should": [                  {                    "fuzzy": {                      "model_name": "word2"                    }                  },                  {                    "fuzzy": {                      "product_name": "word2"                    }                  }                ]              }            }          }        }      ]    }  }}