0

长话短说。

我需要使用 elasticjs 创建一个类似物进行查询:

http://example.com/one/two/_search?q=tags:three*

我对文档页面上列出的选项感到困惑。已经尝试创建BoolQueryTermQuery其他几个,但它们对我不起作用。

我现在被困住了,希望能在这个问题上提供任何帮助。

PS 还有同一个问题的另一面。我找不到 json 应该如何获取相同的数据。到目前为止想出了这个解决方案,但不幸的是它不起作用:

{
  "query": {
    "bool": {
      "should": [
        {
          "term": {
            "tag": "three*"
          }
        }
      ]
    }
  }
}
4

1 回答 1

1
ejs.Request()
    .indices("one") 
    .types("two")
    .query(ejs.QueryStringQuery ( "tags:three*" ))
    .doSearch(function (data) {
        // do something with data
    });

PS在json中:

{
  "query": {
    "query_string": {
      "query": "tags:three*"
    }
  }
}

或者

{
  "query": {
    "wildcard": {
      "tags": "three*" 
    }
  }
}
于 2013-04-06T20:54:22.700 回答