QueryProcessor

更新时间:
复制 MD 格式

A QueryProcessor defines a query analysis rule for an OpenSearch application. It specifies which processors to apply, which indexes the rule targets, and whether the rule is the active default.

Structure

{
    "name": "qp_lsh_test_1",
    "domain": "GENERAL",
    "processors": [{
        "name": "stop_word",
        "use_system_dictionary": true,
        "intervention_dictionary": ""
    }],
    "indexes": [
        "default"
    ],
    "active": true
}
FieldTypeDescription
nameStringThe name of the query analysis rule. Can contain lowercase letters, digits, and underscores (_). Must start with a lowercase letter. Maximum 16 characters.
domainStringThe industry domain the rule applies to. Valid values: GENERAL, ECOMMERCE, IT_CONTENT.
processors[]ObjectThe processors to apply in this rule. Each entry is a Processor object. See Processor below.
indexesArrayThe indexes this rule applies to.
activeBooleanWhether this rule is the default query analysis rule.

Processor

A processor defines a single query analysis feature and its configuration.

OpenSearch supports six processor types:

Processor nameFeature
stop_wordStop word filtering
spell_checkSpelling correction
term_weightingTerm weight analysis
synonymSynonym configuration
category_predictionCategory prediction — see Category prediction
nerNamed Entity Recognition (NER) — see NER

Fields

{
    "name": "stop_word",
    "use_system_dictionary": true,
    "intervention_dictionary": ""
}
FieldTypeDescription
nameStringThe processor type. Valid values: stop_word, spell_check, term_weighting, synonym, category_prediction, ner.
use_system_dictionaryBooleanSpecifies whether to use built-in dictionaries.
intervention_dictionaryStringThe name of the intervention dictionary. Leave blank if not applicable.

Category prediction

Use the category_prediction processor to apply a trained category prediction model.

Fields

{
    "name": "stop_word",
    "categoryPrediction": 12345,
    "projectId": 12346
}
FieldTypeDescription
nameStringMust be category_prediction.
categoryPredictionIntegerThe ID of the category prediction model.
projectIdIntegerThe ID of the algorithm project.

NER

Use the ner processor to apply Named Entity Recognition (NER) and control the priority of recognized entity types.

Fields

{
    "name": "stop_word",
    "use_system_dictionary": true,
    "intervention_dictionary": "",
    "priorities": [{
        "priority": "HIGH",
        "tag": "test",
        "order": 1
    }]
}
FieldTypeDescription
nameStringMust be ner.
use_system_dictionaryBooleanSpecifies whether to use built-in dictionaries.
intervention_dictionaryStringThe name of the intervention dictionary. Leave blank if not applicable.
priorities[]ObjectPriority settings for entity types.
priorities[].priorityStringThe priority level. Valid values: HIGH, MIDDLE, LOW.
priorities[].tagStringThe internal name of the entity type.
priorities[].orderIntegerThe rank within entity types that share the same priority level. A lower value means higher priority. Default: 0.