Unable to search '#' in elasticsearch

可紊 提交于 2019-12-25 04:01:23

问题


This query -

curl -XGET http://localhost:9200/haystack/modelresult/_search?q=post_text:#test

fails to execute with an error

SearchPhaseExecutionException[Failed to execute phase

with status 400


回答1:


Try this:

curl -XPOST "http://localhost:9200/haystack/modelresult/_search" -d'
{
    "query": {
        "match": {
           "post_text": "#test"
        }
    }
}'

or this:

curl -XPOST "http://localhost:9200/haystack/modelresult/_search" -d'
{
    "query": {
        "term": {
           "post_text": "#test"
        }
    }
}'


来源:https://stackoverflow.com/questions/33901928/unable-to-search-in-elasticsearch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!