Open w33ble opened 10 years ago
Hi @w33ble
Yes... This is a tricky one. Elasticsearch can accept plain text in the body, eg:
curl localhost:9200/_analyze?analyzer=standard -d '
Text to analyze here
'
This is a much clearer syntax for explanation purposes than:
curl localhost:9200/_analyze?analyzer=standard&text=Text%20to%20analyze%20here
However, Sense can only handle JSON bodies, not plain text. With a JSON body it knows where the end of the body should be. A plain text body might include paragraphs, so where does the body actually end?
There is an open issue (https://github.com/elasticsearch/elasticsearch/issues/5866) to allow the analyze
end point to accept JSON instead of text, which would solve this issue.
Cool, thanks for the feedback. Curious: is analyze the only command that's takes text instead of JSON?
No, there are the scroll and clear scroll APIs too, but those are less problematic.
Just curious how do I do scroll api in Sense then? Thanks,
I first noticed this in
/080_Structured_Search/05_term.asciidoc
- The following example is in the docs, but it doesn't work when you try to copy and paste it into Sense, and the link to view in Sense actually sends different content.Docs (results in an error, text is not passed to the request)
note: the request is not escaped (# vs %23), so even if you fix the syntax, you get different results (the content from # on is dropped) - perhaps this should also be pointed out in the docs.
Sense
This is also an issue with the code in
/052_Mapping_Analysis/40_Analysis.asciidoc
and I suspect in other parts of the docs as well.It's possible this is actually a Sense bug, but someone took the time to update the Sense json in the docs without updating the examples, and the docs are technically broken as-is.