【问题标题】:query string doesn't work in elasticsearch scan&scroll search查询字符串在弹性搜索扫描和滚动搜索中不起作用
【发布时间】:2015-09-17 10:55:46
【问题描述】:

当我尝试时:

curl -XPOST 'http://localhost:9200/index/type/_search?search_type=scan&scroll=2m' -d '{"query": {"match": {"host":"xxxx"}}}'

我收到了scroll_id。然后我发出:

curl -XPOST 'http://localhost:9200/_search/scroll?scroll=1m&scroll_id=......'

但响应包含属于其他主机的日志。 为什么以及如何解决?

非常感谢

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    尝试使用术语查询而不是匹配:

    {"query": {"term": {"host":"xxxx"}}}
    

    这将寻找确切的值,而不是分析您对 xxxx 的值,并且对差异的讨论是:https://www.elastic.co/guide/en/elasticsearch/guide/current/term-vs-full-text.html

    如果这不起作用,也可能是正在分析该字段,并且映射也需要更新。能否分享一下索引和类型的映射:http://localhost:9200/index/_mapping/type/?pretty

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-10
      • 1970-01-01
      • 2020-01-08
      • 2014-12-09
      • 1970-01-01
      • 1970-01-01
      • 2021-01-28
      相关资源
      最近更新 更多