Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
SunnyBo0302 opened this issue Feb 8, 2022 · 1 comment · Fixed by #292
Closed
Labels
Area: Specification Related to the API spec used to generate client code

Comments

@SunnyBo0302
Copy link

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.

@swallez
Copy link
Member

swallez commented May 24, 2022

This has been fixed in PR #292, backported to version 8.2 in PR #293 and to version 7.17 in PR #294.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Specification Related to the API spec used to generate client code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants