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

[Query Rules] Combining fuzzy matches with numeric matches leads to errors #102827

Closed
kderusso opened this issue Nov 30, 2023 · 2 comments · Fixed by #102891
Closed

[Query Rules] Combining fuzzy matches with numeric matches leads to errors #102827

kderusso opened this issue Nov 30, 2023 · 2 comments · Fixed by #102891
Assignees
Labels
>bug :EnterpriseSearch/Application Enterprise Search Team:Enterprise Search Meta label for Enterprise Search team

Comments

@kderusso
Copy link
Member

kderusso commented Nov 30, 2023

Elasticsearch Version

8.10+

Installed Plugins

No response

Java Version

bundled

OS Version

Any

Problem Description

Combining query rules with numeric and fuzzy text matches can lead to errors when fuzzy matches should be matched on.

Steps to Reproduce

Example script to reproduce:

POST /test/_doc/1
{
  "title": "the old man and the sea"
}

POST /test/_doc/2
{
  "title": "a tale of two cities"
}

POST /test/_doc/3
{
  "title": "the great gatsby"
}

PUT /_query_rules/test-ruleset
{
  "rules": [
    {
      "rule_id": "1",
      "type": "pinned",
      "criteria": [
        {
          "type": "fuzzy",
          "metadata": "foo",
          "values": ["foo"]
        }
      ],
      "actions": {
        "ids": [
          "1"
        ]
      }
    },
    {
      "rule_id": "2",
      "type": "pinned",
      "criteria": [
        {
          "type": "fuzzy",
          "metadata": "foo",
          "values": ["bar", "baz"]
        }
      ],
      "actions": {
        "ids": [
          "2"
        ]
      }
    },
      {
      "rule_id": "3",
      "type": "pinned",
      "criteria": [
        {
          "type": "lte",
          "metadata": "foo",
          "values": [10000]
        }
      ],
      "actions": {
        "ids": [
          "3"
        ]
      }
    }
  ]
}

POST /test/_search
{
  "query": {
    "rule_query": {
      "organic": {
        "multi_match": {
          "query": "fooo" // included a typo
        }
      },
      "match_criteria": {
        "foo": "fooo"
      },
      "ruleset_id": "test-ruleset"
    }
  }
}

The rule query returns the following error:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Input [fooo] is not valid for CriteriaType [lte]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Input [fooo] is not valid for CriteriaType [lte]"
  },
  "status": 400
}

Logs (if relevant)

No response

@kderusso kderusso added >bug :EnterpriseSearch/Application Enterprise Search Team:Enterprise Search Meta label for Enterprise Search team labels Nov 30, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ent-search-eng (Team:Enterprise Search)

@kderusso
Copy link
Member Author

kderusso commented Dec 1, 2023

PR: #102891

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :EnterpriseSearch/Application Enterprise Search Team:Enterprise Search Meta label for Enterprise Search team
Projects
None yet
2 participants