Elasticsearch equal SQL %Like% Elasticsearch equal SQL %Like% elasticsearch elasticsearch

Elasticsearch equal SQL %Like%


Try using bool and wildcard to do such a query.

{    "query": {        "bool": {            "must": [                {                    "wildcard": {                        "text": "*quick*"                    }                },                {                    "wildcard": {                        "text": "*brown*"                    }                },                {                    "wildcard": {                        "text": "*fox*"                    }                }            ]        }    }}

Wildcard Query Matches documents that have fields matching a wildcard expression (not analyzed). Supported wildcards are *, which matches any character sequence (including the empty one), and ?, which matches any single character.


That's what you're looking for. Just put desired amount of wildcard queries in your bool/must:

{  "query": {    "bool": {      "must": [        {          "wildcard": {            "text": {              "value": "*quick*"            }          }        },        {          "wildcard": {            "text": {              "value": "*brown*"            }          }        },        {          "wildcard": {            "text": {              "value": "*fox*"            }          }        }      ]    }  }}