Saving percolator with query string and wildcard fields search

Hello I am trying to save percolator query with code which looks like this
"query": "Content.\\*:apple OR android"
but i got error response which looks like this
No field mapping can be found for the field with name [Content.*].
If I try to use search using this exact query it works. And if I will save percolate query with single words endlosed in parenthesis it works too.

I did not managed to found any solution nor issue on github or topic in disussion.

Here is example of code which I am trying to run and don´t work:

PUT someindex/_doc/333-444-fr
{
  "Percolate": {
    "TopicId": 444,
    "MonitoringId": 333,
    "LanguageCode": "FR",
    "Query": {
      "query_string": {
        "query": "Content.\\*:apple OR android"
        
      }
    }
  },
  "Id": "333-444-fr"
}

Here is example of code which works:

PUT someindex/_doc/333-444-fr
{
  "Percolate": {
    "TopicId": 444,
    "MonitoringId": 333,
    "LanguageCode": "FR",
    "Query": {
      "query_string": {
        "query": "Content.\\*:\"apple\" OR \"android\""
        
      }
    }
  },
  "Id": "333-444-fr"
}

Here is link to documentation which I am using.
[Query string query | Elasticsearch Guide [7.16] | Elastic](https://query-string-query documentation)

1 Like

IMO this shoul be considered as BUG

What I need to do to send this as a Bug?

Can you provide a fully reproducible example including index creation and mapping along with the version that you are using?

Thank you!

Hello,
Thank you for response!
Our version of ES is 7.14.2. I wast trying narrow down our business mapping until I came across very first exampple of percolating on documentation page. I only changed type of matching documents from terms to query string query.

Create an index with two fields:

PUT /my-index-000001
{
  "mappings": {
    "properties": {
      "message": {
        "type": "text"
      },
      "query": {
        "type": "percolator"
      }
    }
  }
}
Register a query in the percolator:

PUT /my-index-000001/_doc/1?refresh
{
  "query": {
    "query_string": {
      "query": "bonsai tree"
    }
  }
}

Where I got this (same) error .

No field mapping can be found for the field with name [*]

By switching to a query_string you changed the query actually. The match query only searches in the message field, by not specifying a field in the query_string query it tries to query all fields, and that is failing. Try using concrete field.

Hello,

but I am specifiyng field in query (original post).

Either way I think this is bug. What do you think?

Thank you

The above query is not directed for a specific field.

I meant this one :slight_smile: It's ok :slight_smile:

I just tried this, which ended up with the same error.


PUT /my-index-000001/_doc/1?refresh
{
  "query": {
    "query_string": {
      "query": "message:bonsai tree"
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.