Browse Source

docs(elasticsearch-plugin): Add examples to recent api additions

Michael Bromley 4 years ago
parent
commit
def07b2bb3
1 changed files with 41 additions and 0 deletions
  1. 41 0
      packages/elasticsearch-plugin/src/options.ts

+ 41 - 0
packages/elasticsearch-plugin/src/options.ts

@@ -61,6 +61,30 @@ export interface ElasticsearchOptions {
      * [These options](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/index-modules.html#index-modules-settings)
      * [These options](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/index-modules.html#index-modules-settings)
      * are directly passed to index settings. To apply some settings indices will be recreated.
      * are directly passed to index settings. To apply some settings indices will be recreated.
      *
      *
+     * @example
+     * ```TypeScript
+     * // Configuring an English stemmer
+     * indexSettings: {
+     *   analysis: {
+     *     analyzer: {
+     *       custom_analyzer: {
+     *         tokenizer: 'standard',
+     *         filter: [
+     *           'lowercase',
+     *           'english_stemmer'
+     *         ]
+     *       }
+     *     },
+     *     filter : {
+     *       english_stemmer : {
+     *         type : 'stemmer',
+     *         name : 'english'
+     *       }
+     *     }
+     *   }
+     * },
+     * ```
+     *
      * @since 1.2.0
      * @since 1.2.0
      * @default
      * @default
      * {}
      * {}
@@ -72,6 +96,23 @@ export interface ElasticsearchOptions {
      * [mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html)
      * [mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html)
      * After changing this option indices will be recreated.
      * After changing this option indices will be recreated.
      *
      *
+     * @example
+     * ```TypeScript
+     * // Configuring custom analyzer for the `productName` field.
+     * indexMappingProperties: {
+     *   productName: {
+     *     type: 'text',
+     *     analyzer:'custom_analyzer',
+     *     fields: {
+     *       keyword: {
+     *         type: 'keyword',
+     *         ignore_above: 256,
+     *       }
+     *     }
+     *   }
+     * }
+     * ```
+     *
      * @since 1.2.0
      * @since 1.2.0
      * @default
      * @default
      * {}
      * {}