LINUX.ORG.RU

История изменений

Исправление samson_b, (текущая версия) :

Попробовал разобраться с этим, установил elasticsearch и создал индекс и несколько документов

PUT /test
{
    "mappings" : {
        "properties" : {
            "description" : { 
                "type" : "text",
                "term_vector": "yes"
            }
        }
    }
}

PUT /test/_doc/1
{
    "description" : "Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified"
}

PUT /test/_doc/2
{
    "description" : "There is no \"correct\" number of actions to perform in a single bulk request. Experiment with different settings to find the optimal size for your particular workload."
}

PUT /test/_doc/3
{
    "description" : "Index operations  can be 123 made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified."
}

Дальше сделал запрос на выборку

{
    "query": {
        "more_like_this" : {
            "fields" : ["description"],
            "like" : "Index operations  can be 123 made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified.",
            "min_term_freq" : 1,
            "max_query_terms" : 5,
            "min_doc_freq": 1
        }
    }
}

Если «max_query_terms» : 5, то выдает все 3 документа, если 10, то уже 2, т.е. увеличение max_query_terms ведет к устрожению поиска, но в тоже время добиться выдачи одного документа не удалось. Если min_term_freq выставить на 2 или больше, всегда поиск выдает 3 документа

Честно говоря не понял, как регулировать строгость поиска, чтобы он в итоге выдавал один документ и что min_term_freq и max_query_terms значат.

Подскажите.

Исходная версия samson_b, :

Попробовал разобраться с этим, установил elasticsearch и создал индекс и несколько документов

PUT /test
{
    "mappings" : {
        "properties" : {
            "description" : { 
                "type" : "text",
                "term_vector": "yes"
            }
        }
    }
}

PUT /test/_doc/1
{
    "description" : "Index operations can be made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified"
}

PUT /test/_doc/2
{
    "description" : "There is no \"correct\" number of actions to perform in a single bulk request. Experiment with different settings to find the optimal size for your particular workload."
}

PUT /test/_doc/3
{
    "description" : "Index operations  can be 123 made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified."
}

Дальше сделал запрос на выборку

{
    "query": {
        "more_like_this" : {
            "fields" : ["description"],
            "like" : "Index operations  can be 123 made conditional and only be performed if the last modification to the document was assigned the sequence number and primary term specified.",
            "min_term_freq" : 1,
            "max_query_terms" : 5,
            "min_doc_freq": 1
        }
    }
}

Если «max_query_terms» : 5, то выдает все 3 документа, если 10, то уже 2, т.е. увеличение max_query_terms ведет к устрожению поиска, но в тоже время добиться выдачи одного документа не удалось. Если min_term_freq выставить на 2 или больше, всегда поиск выдает 3 документа

Честно говоря не понял, как регулировать строгость поиска, чтобы он в итоге выдавал один документ и что min_term_freq и max_query_terms.

Подскажите.