2

弹性搜索版本 - .90.1

以下工作完美。

cat names
{"index":"events","type":"news"}
{"query":{"term":{"Type":"MarketEvent"}}}
{"query":{"term":{"Type":"MarketEvent"}}}

curl -XGET 'http://localhost:9200/_msearch'  --data-binary @names

以下也有效

{"index":"events","type":"news"}
{"query":{"bool":{"must":[{"query_string":{"query":"*","fields":["Events.Event"],"default_operator":"AND"}},{"term":{"Type":"MarketEvent"}}]}}}

但是超过 1 个布尔值的查询不起作用 -

cat names
{"index":"events","type":"news"}
{"query":{"bool":{"must":[{"query_string":{"query":"*","fields":["Events.Event"],"default_operator":"AND"}},{"term":{"Type":"MarketEvent"}}]}}}
{"query":{"bool":{"must":[{"query_string":{"query":"*","fields":["Events.Event"],"default_operator":"AND"}},{"term":{"Type":"MarketEvent"}}]}}}

curl -XGET 'http://localhost:9200/_msearch'  --data-binary @names
{"error":"must doesn't support arrays"}

我在日志中没有看到任何日志(也没有在调试模式下)这是一个错误吗?

4

1 回答 1

3

查询应具有以下_msearch格式:

header\n
body\n
header\n
body\n

在第一个和最后一个查询中,缺少第二个标头。仅由于解析标头的方式,不会为第一个查询生成错误。要使此查询正常工作,names应将文件更改为

{"index":"events","type":"news"}
{"query":{"bool":{"must":[{"query_string":{"query":"*","fields":["Events.Event"],"default_operator":"AND"}},{"term":{"Type":"MarketEvent"}}]}}}
{"index":"events","type":"news"}
{"query":{"bool":{"must":[{"query_string":{"query":"*","fields":["Events.Event"],"default_operator":"AND"}},{"term":{"Type":"MarketEvent"}}]}}}
于 2013-06-08T14:37:49.317 回答