ElasticSearch Nested Search Analyzer not working

Index Creation

I'm creating index with nested property and assigning analyzers to it both index and search time as follows.

PUT /test_index_pasu
{
  "settings": {
    "analysis": {
      "analyzer": {
        "keyword_analyzer": {
          "tokenizer": "keyword",
          "filter": [
            "lowercase",
            "asciifolding"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "groups": {
        "type": "nested",
        "properties": {
          "key": {
            "type": "keyword"
          },
          "values": {
            "type": "text",
            "analyzer": "keyword_analyzer",
            "search_analyzer": "keyword_analyzer",
            "fields": {
              "keyword": {
                "type": "keyword"
              }
            }
          }
        }
      }
    }
  }
}

When I try to query (search filter) search time analyzer wasn't honored. I tried to check the GET mapping, it is missing search_analyzer anything specific needs to be done for nested search analyzer.?

Get Mapping Index

{
  "test_index_pasu": {
    "mappings": {
      "properties": {
        "groups": {
          "type": "nested",
          "properties": {
            "key": {
              "type": "keyword"
            },
            "values": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword"
                }
              },
              "analyzer": "keyword_analyzer"
            }
          }
        }
      }
    }
  }
}

HI @pasupathi-raja

What type of problem are you facing with search_analyzer? Do you have any example?

Usually, the same analyzer should be applied at index time and at search time, to ensure that the terms in the query are in the same format as the terms in the inverted index.

The issue is, if you check the Get Mapping Index response json, test_index_pasu.mappings.properties.groups.properties.values missing search_analyzer but when I create index, I added it at mappings.properties.groups.properties.values.search_analyzer

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