Elasticsearch server Chapter5

  • View
    525

  • Download
    0

Embed Size (px)

Text of Elasticsearch server Chapter5

  • Elasticsearch Serverchapter5.

  • elasticsearch

  • 1. Apache Lucene scoring

    TD/IDF(Term Frequency - Inverse Document Frequency)

  • Score properties (Document boost)

    (Field boost)

    (Coord)

    IDF(Inverse Document Frequency)

    (Length norm)

    . .

    Term frequency

  • score(q,d)=coord(q,d)queryNorm(q)(tf (tind)idf (t)2 boost(t)norm(t,d))

    .

    .

    .

    ref : https://lucene.apache.org/core/4_0_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html

  • 2. Scripting

    elasticsearch

    MVEL

    javascript, python, groovy

  • 3.

  • (Apache Tika)

    (Language detection)

    .

  • query field

  • { "query" : {

    "prefix" : {

    "title" : {

    "value" : "cri",

    "boost" : 3.0

    }

    }

    }

    }

  • Demo - boost query

  • {

    "query": {

    "constant_score": {

    "query": {

    "query_string": {

    "query": "available:false author:heller"

    }

    }

    }

    }

    }

  • Demo - constant_score

  • { "title" : "The Complete Sherlock Holmes", "author" : "Arthur Conan Doyle", "year": 1936 }

  • { "title" : "The Complete Sherlock Holmes", "author" : { "_value" : "Arthur Conan Doyle", "_boost" : 10.0, }, "year": 1936 }

  • 6.

    ,

    crime Crime and Punishment , criminality abuse

  • synonym

    analyzer synonym

    synonym

  • criminality, wars => crime

    abuse => punishment

    one, two, three => one, two, three

  • 7.

    Analyze API(Testing Analyzers)

    elasticsearch tokenize

    index .

    elasticsearch analyze API ()

    : https://www.elastic.co/guide/en/elasticsearch/guide/current/analysis-intro.html?q=_analy

  • Demo - analyze API

  • 7.

    Explain API

    : https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html?q=_explain

  • Demo - explain API