Skip to content

Analysis API with explain fails to parse "attributes" from plugin-installed analyzer #154

Closed
@SunnyBo0302

Description

@SunnyBo0302

With nori_analyzer,

request

GET _analyze
{
    "analyzer": "nori",
    "text": "abc",
    "explain": true
}

response

{
    "detail": {
        "custom_analyzer": false,
        "analyzer": {
            "name": null,
            "tokens": [
                {
                    "token": "abc",
                    "start_offset": 0,
                    "end_offset": 3,
                    "type": "word",
                    "position": 0,
                    "bytes": "[61 62 63]",
                    "leftPOS": "SL(Foreign language)",
                    "morphemes": null,
                    "posType": "MORPHEME",
                    "positionLength": 1,
                    "reading": null,
                    "rightPOS": "SL(Foreign language)",
                    "termFrequency": 1
                }
            ]
        }
    }
}

Using analyze API provided in ElasticsearchIndicesAsyncClient.java

request

AnalyzeRequest analyzeRequest = new AnalyzeRequest.Builder()
          .analyzer("nori")
          .text("abc")
          .index(MY_INDEX)
          .explain(true)
          .build();

Since there is no such variable "attributes" in ExplainAnalyzeToken.java which was present in RHLC AnalyzeResponse.java,
there is no way to retrieve response values "posType", "rightPOS" ,... and etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: SpecificationRelated to the API spec used to generate client code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions