Skip to content

tahaderouiche/elasticsearch-gomycode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Gomycode elasticsearch workshop

This repo provides the instructions and examples from the demo highlighting the features of elasticsearch.

Getting started

Elastic Cloud

Launch an elasticsearch service instance on elastic cloud

Local

Using Docker, you can get up and running using the stack docker-compose file on github .

git clone https://github.com/elastic/stack-docker.git
docker-compose -f setup.yml up
docker-compose up -d elasticsearch kibana

Analyzers

English

GET /_analyze
{
  "analyzer": "english",
  "text": "I will either find a way or make one."
}

html strip + stop words

GET /_analyze
{
  "char_filter": [
    "html_strip"
  ],
  "tokenizer": "standard",
  "filter": [
    "lowercase",
    "stop"
  ],
  "text": "I will either find a <em>way</em>  or make one."
}

French

GET /_analyze
{
  "analyzer": "french",
  "text": "Je trouverai un chemin, ou j’en créerai un."
}

Synonyms

PUT /hannibal
{
  "settings": {
    "analysis": {
      "filter": {
        "my_synonym_filter": {
          "type": "synonym",
          "synonyms": [
            "make,create"
          ]
        }
      },
      "analyzer": {
        "my_analyzer" : {
          "char_filter": [
            "html_strip"
          ],
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "stop",
            "my_synonym_filter"
          ]
        }
      }
    }
  },
  "mappings": {
    "_doc": {
      "properties": {
        "quote": {
          "type": "text",
          "analyzer": "my_analyzer"
        }
      }
    }
  }
}
PUT /hannibal/_doc/1
{
  "quote": "I will either find a <em>way</em>  or make one."
}
PUT /hannibal/_doc/2
{
  "quote": "I have come not to make war on the Italians, but to aid the Italians against Rome."
}
PUT /hannibal/_doc/3
{
  "quote": "God has given to man no sharper spur to victory than contempt of death."
}

Search

POST /hannibal/_search
{
  "query": {
    "match_all": { }
  }
}
POST /hannibal/_search
{
  "query": {
    "match": {
      "quote": "make"
    }
  }
}
POST /hannibal/_search
{
  "query": {
    "match": {
      "quote": "create"
    }
  }
}

Score

POST /hannibal/_search?explain=true
{
  "query": {
    "match": {
      "quote": "make"
    }
  }
}

About

Details of the gomycode workshop about elasticsearch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published