Term_vectors and custom analyzers

Hello,

I'm running Elasticsearch 7.3.2 in Elastic Cloud. I have built a mapping for one of my indices where I have used a custom analyzer: "standard-uax-url-analyzer" that is essentially the standard analyzer, but it is more tolerant of email addresses and html.

The problem I am having is I have a field in my mapping "body" that I put the standard-uax-url-analyzer on:

"body": {
            "type": "text",
            "term_vector": "with_positions_offsets",
            "analyzer": "standard-uax-url-analyzer",
            "fields": {
                "english": {
                    "type": "text",
                    "term_vector": "with_positions_offsets",
                    "analyzer": "english_email"
                }
            }
        }

But, whenever I look at my index in Kibana with GET my_index, or GET my_index/_mapping, the analyzer field does not appear:

"body" : {
      "type" : "text",
      "term_vector" : "with_positions_offsets",
      "fields" : {
        "english" : {
          "type" : "text",
          "term_vector" : "with_positions_offsets",
          "analyzer" : "english_email"
        }
      },

These code excerpts are directly from my Kibana console. The first is a subset of my PUT my_index command, the second from my GET my_index/_mapping command.

Does anyone have any idea why my analyzer field disappears? Did my "body" field revert to the standard analyzer? Is it using my correct analyzer, but not showing it? As you can see in the above code snippets, my body.english field retained its "english_email" analyzer, and other fields where I used "standard-uax-url-analyzer" as the analyzer, it still appears as such. Any ideas?

Could you please try:

GET my_index/_mapping?include_defaults=true

This should make clear which analyzer is being used.

I gave that a try in Kibana. The error I got back was:
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/emails/_mapping] contains unrecognized parameter: [include_defaults]"
}
],
"type": "illegal_argument_exception",
"reason": "request [/emails/_mapping] contains unrecognized parameter: [include_defaults]"
},
"status": 400
}

That being said, the "analyzer": "standard-uax-url-analyzer" line eventually showed up in my mapping at the correct spot. I just don't understand why it didn't show up initially.

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