Giter VIP home page Giter VIP logo

hlsa_lesson9's Introduction

Open Kibana DevConsole http://localhost:5602/app/dev_tools#/console

Create index

PUT autocomplete
{
  "mappings": {
    "properties": {
      "message": {
        "type": "completion"
      }
    }
  }
}

Start reindex english vocabulary

POST _reindex
{
  "source": {
    "index": "english_words"
  },
  "dest": {
    "index": "autocomplete"
  }
}

Start search words by key "machematikal" (2 mistakes were made)

GET autocomplete/_search?pretty
{
  "suggest": {
    "word-suggest": {
      "prefix": "machematikal",
      "completion": {
        "field": "message",
        "fuzzy": {
          "fuzziness": 3,
          "min_length": 7
        }
      }
    }
  },
  "fields": [
    "message",         
    {
      "field": "@timestamp",
      "format": "epoch_millis" 
    }
  ],
  "_source": false
}

Response

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "suggest" : {
    "word-suggest" : [
      {
        "text" : "machematikal",
        "offset" : 0,
        "length" : 12,
        "options" : [
          {
            "text" : "mathematical",
            "_index" : "autocomplete",
            "_type" : "_doc",
            "_id" : "v8U4eX0BcFJFXqBQ6UoM",
            "_score" : 2.0,
            "fields" : {
              "@timestamp" : [
                "1638416311961"
              ],
              "message" : [
                "mathematical"
              ]
            }
          },
          {
            "text" : "mathematically",
            "_index" : "autocomplete",
            "_type" : "_doc",
            "_id" : "wMU4eX0BcFJFXqBQ6UoM",
            "_score" : 2.0,
            "fields" : {
              "@timestamp" : [
                "1638416311961"
              ],
              "message" : [
                "mathematically"
              ]
            }
          },
          {
            "text" : "mathematicals",
            "_index" : "autocomplete",
            "_type" : "_doc",
            "_id" : "wcU4eX0BcFJFXqBQ6UoM",
            "_score" : 2.0,
            "fields" : {
              "@timestamp" : [
                "1638416311961"
              ],
              "message" : [
                "mathematicals"
              ]
            }
          }
        ]
      }
    ]
  }
}

Start search words by key "autocompletess" (3 mistakes were made)

GET autocomplete/_search?pretty
{
  "suggest": {
    "word-suggest": {
      "prefix": "autocompletess",
      "completion": {
        "field": "message",
        "fuzzy": {
          "fuzziness": 3,
          "min_length": 7
        }
      }
    }
  },
  "fields": [
    "message",         
    {
      "field": "@timestamp",
      "format": "epoch_millis" 
    }
  ],
  "_source": false
}

Response

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "suggest" : {
    "word-suggest" : [
      {
        "text" : "autocompletess",
        "offset" : 0,
        "length" : 14,
        "options" : [
          {
            "text" : "autocomplexes",
            "_index" : "autocomplete",
            "_type" : "_doc",
            "_id" : "u8I4eX0BcFJFXqBQWuTH",
            "_score" : 10.0,
            "fields" : {
              "@timestamp" : [
                "1638416275241"
              ],
              "message" : [
                "autocomplexes"
              ]
            }
          }
        ]
      }
    ]
  }
}

Start search words by key "machem" (1 mistakes were made and less than 7 characters)

GET autocomplete/_search?pretty
{
  "suggest": {
    "word-suggest": {
      "prefix": "machem",
      "completion": {
        "field": "message",
        "fuzzy": {
          "fuzziness": 3,
          "min_length": 7
        }
      }
    }
  },
  "fields": [
    "message",         
    {
      "field": "@timestamp",
      "format": "epoch_millis" 
    }
  ],
  "_source": false
}

Response

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "suggest" : {
    "word-suggest" : [
      {
        "text" : "machem",
        "offset" : 0,
        "length" : 6,
        "options" : [ ]
      }
    ]
  }
}

hlsa_lesson9's People

Watchers

James Cloos avatar Serhii avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.