Elasticsearch:用符号$搜索

时间:2016-08-05 13:41:24

标签: python elasticsearch

我创建了查询

curl -XPUT 'localhost:9200/liza_index/.percolator/UNIQ_ID20' -d '{"query" : {"match" : {"regexp" : {"message" : "50"}}}}'

并尝试在文本中找到匹配“现在花费约50美元”:

curl -XGET 'localhost:9200/liza_index/liza_type/_percolate' -d '{"doc" : {"message" : "it costs about $50 now"}}'

当'50'和'$'之间没有空格时,查询不起作用。但是当有空间时,它就有效。虽然在标记后文本看起来像

{
"tokens": [{
    "token": "it",
    "start_offset": 0,
    "end_offset": 2,
    "type": "<ALPHANUM>",
    "position": 0
}, {
    "token": "costs",
    "start_offset": 3,
    "end_offset": 8,
    "type": "<ALPHANUM>",
    "position": 1
}, {
    "token": "about",
    "start_offset": 9,
    "end_offset": 14,
    "type": "<ALPHANUM>",
    "position": 2
}, {
    "token": "50",
    "start_offset": 16,
    "end_offset": 18,
    "type": "<NUM>",
    "position": 3
}, {
    "token": "now",
    "start_offset": 19,
    "end_offset": 22,
    "type": "<ALPHANUM>",
    "position": 4
}]}

两种情况。

为什么我不能找到与'$'一起写的'50'?我该怎么办?

0 个答案:

没有答案