jprante / elasticsearch-langdetect

A plugin for language detection in Elasticsearch using Nakatani Shuyo's language detector
Apache License 2.0
251 stars 46 forks source link

Seems like landdetect 5.3 does not work or documentation has incorrect examples #59

Closed lexand closed 7 years ago

lexand commented 7 years ago

My config ES:

$ curl -XGET http://127.0.0.1:9200
{
  "name" : "D8Tv5qq",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "56FxolywSQW5Xx4WzxI0mg",
  "version" : {
    "number" : "5.3.0",
    "build_hash" : "3adb13b",
    "build_date" : "2017-03-23T03:31:50.652Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.1"
  },
  "tagline" : "You Know, for Search"
}

Kibana 5.3 and plugins

GET _cat/plugins
D8Tv5qq analysis-icu        5.3.0
D8Tv5qq analysis-morphology 5.3.0
D8Tv5qq langdetect          5.3.0.0

my tryes

{ "error": { "root_cause": [ { "type": "json_generation_exception", "reason": "Can not write a field name, expecting a value" } ], "type": "json_generation_exception", "reason": "Can not write a field name, expecting a value" }, "status": 500 }


- from cURL

$ curl -XPOST http://127.0.0.1:9200/_langdetect -d '{"text":"some text"}' {"error":{"root_cause":[{"type":"json_generation_exception","reason":"Can not write a field name, expecting a value"}],"type":"json_generation_exception","reason":"Can not write a field name, expecting a value"},"status":500}

$ curl -XGET http://127.0.0.1:9200/_langdetect -d '{"text":"some text"}' {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"No endpoint or operation is available at [_langdetect]"}],"type":"illegal_argument_exception","reason":"No endpoint or operation is available at [_langdetect]"},"status":400}

$ curl -XGET http://127.0.0.1:9200/_langdetect -d 'some text' {"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}

$curl -XPOST http://127.0.0.1:9200/_langdetect -d 'some text' {"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}



so maybe I'm doing somewhat wrong ?
Please help.

regards
Alex
jprante commented 7 years ago

Thanks for the report.

There is a REST endpoint problem. I will look into it.

jprante commented 7 years ago

I think version 5.3.0.1 will fix the issue.

lexand commented 7 years ago

Thanks

all works fine

esen commented 7 years ago

The same is happening with version 5.3.2.0

jprante commented 7 years ago

The command

curl -XPOST http://127.0.0.1:9200/_langdetect -d '{"text":"this is a short text"}'

works with 5.3.2.0

esen commented 7 years ago

Oh, I'm sorry. Thanks, it works that way.

The following doesn't work:

curl -XPOST 'localhost:9200/_langdetect?pretty' -d 'This is a test'

which is on in Readme file https://github.com/jprante/elasticsearch-langdetect#language-detection-rest-api-example