Skip to content

[BUG] Certain fields are unexpectedly not compatible with patterns command #4365

@paulstn

Description

@paulstn

What is the bug?

In an index where the mapping is as below:

{
  "opensearch_dashboards_sample_data_ecommerce": {
    "aliases": {},
    "mappings": {
      "properties": {
        "category": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "currency": {
          "type": "keyword"
        },
        "customer_birth_date": {
          "type": "date"
        },
        "customer_first_name": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
...

Running this PPL Query:

source = opensearch_dashboards_sample_data_ecommerce | patterns `category`

Returns this error:

"{\n  \"error\": {\n    \"reason\": \"Invalid Query\",\n    \"details\": \"failed to parse field \\\"category\\\" with type [ARRAY]\",\n    \"type\": \"SemanticCheckException\"\n  },\n  \"status\": 400\n}"

However, category just seems to be a text field.

When querying the documents, i see this as what category's values are:

"datarows": [
    [
      [
        "Men's Clothing"
      ]
    ],
    [
      [
        "Women's Clothing"
      ]
    ],
    [
      [
        "Women's Shoes",
        "Women's Clothing"
      ]
    ],
    [
      [
        "Women's Shoes",
        "Women's Clothing"
      ]
    ],
...

So it is an array, but this shouldn't stop patterns at least with the old behavior, according to @joshuali925.

Ideally I want one of two things to be happening instead:

  1. Return patterns back to a state when it would work with documents with value "array".
  2. Have some way of finding out which fields are of type "array" (currently I don't see how I can find that information just from the mapping)

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

What is the expected behavior?
A clear and concise description of what you expected to happen.

What is your host/environment?

  • OS: [e.g. iOS]
  • Version [e.g. 22]
  • Plugins

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
Add any other context about the problem.

Metadata

Metadata

Assignees

Labels

PPLPiped processing languagebugSomething isn't working

Type

No type

Projects

Status

Pending

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions