0
0
Elasticsearchquery~10 mins

Character filters in Elasticsearch - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a character filter that replaces '&' with 'and'.

Elasticsearch
{
  "settings": {
    "analysis": {
      "char_filter": {
        "ampersand_filter": {
          "type": "[1]",
          "mappings": ["&=>and"]
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Ahtml_strip
Breplace
Cpattern_replace
Dmapping
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'replace' or 'pattern_replace' which are not valid character filter types.
Confusing character filters with token filters.
2fill in blank
medium

Complete the code to define a character filter that removes HTML tags.

Elasticsearch
{
  "settings": {
    "analysis": {
      "char_filter": {
        "html_remover": {
          "type": "[1]"
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Amapping
Bhtml_strip
Cpattern_replace
Dkeyword_marker
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'mapping' type which requires explicit mappings.
Confusing with token filters like 'keyword_marker'.
3fill in blank
hard

Fix the error in the character filter definition to replace '#' with 'number'.

Elasticsearch
{
  "settings": {
    "analysis": {
      "char_filter": {
        "hash_filter": {
          "type": "[1]",
          "mappings": ["#=>number"]
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Apattern_replace
Bhtml_strip
Cmapping
Dreplace
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pattern_replace' which requires a regex pattern.
Using 'html_strip' which removes HTML tags.
4fill in blank
hard

Fill both blanks to create a character filter that replaces '@' with 'at' and removes HTML tags.

Elasticsearch
{
  "settings": {
    "analysis": {
      "char_filter": {
        "email_filter": {
          "type": "[1]",
          "mappings": ["@=>at"]
        },
        "clean_html": {
          "type": "[2]"
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Amapping
Bhtml_strip
Cpattern_replace
Dkeyword_marker
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the types for each filter.
Using 'pattern_replace' instead of 'mapping' for simple replacements.
5fill in blank
hard

Fill all three blanks to define a character filter that replaces '$' with 'dollar', removes HTML tags, and replaces '%' with 'percent'.

Elasticsearch
{
  "settings": {
    "analysis": {
      "char_filter": {
        "dollar_filter": {
          "type": "[1]",
          "mappings": ["$=>dollar"]
        },
        "html_cleaner": {
          "type": "[2]"
        },
        "percent_filter": {
          "type": "[3]",
          "mappings": ["%=>percent"]
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Amapping
Bhtml_strip
Cpattern_replace
Dkeyword_marker
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pattern_replace' instead of 'mapping' for simple character replacements.
Confusing the types for each filter.