在Elasticsearch的查询DSL中使用`MatchPhrasePrefix` >>

问题描述 投票:0回答:1

我是Elasticsearch的新手。

有人可以解释为什么进行此搜索(NEST 6):

var searchResponse1 = this.elasticClient.Search<dynamic>(
    s => s.AllTypes().AllIndices().IgnoreUnavailable().Size(100).From(0)
        .Query(q => q.Bool(b => b.Must(m => m.SimpleQueryString(c => c.Query("query"))))));

正确地导致以下请求(我是使用Fiddler获得的:)

POST https://someUrl.com/_search?pretty=true&error_trace=true&typed_keys=true&ignore_unavailable=true HTTP/1.1
{
  "from": 0,
  "query": {
    "bool": {
      "must": [
        {
          "simple_query_string": {
            "query": "query"
          }
        }
      ]
    }
  },
  "size": 100
}

但是以下两项都搜索'MatchPhrasePrefix':

var searchResponse2 = this.elasticClient.Search<dynamic>(
    s => s.AllTypes().AllIndices().IgnoreUnavailable().Size(100).From(0)
        .Query(q => q.Bool(b => b.Must(m => m.MatchPhrasePrefix(c => c.Query("query"))))));

var searchResponse3 = this.elasticClient.Search<dynamic>(
    s => s.AllTypes().AllIndices().IgnoreUnavailable().Size(100).From(0)
        .Query(q => q.MatchPhrasePrefix(p => p.Query("query"))));

结果:

POST https://someUrl.com/_search?pretty=true&error_trace=true&typed_keys=true&ignore_unavailable=true HTTP/1.1
{
  "from": 0,
  "size": 100
}

我在这里想念什么?

我是Elasticsearch的新手。有人可以解释一下为什么进行此搜索(NEST 6):var searchResponse1 = this.elasticClient.Search (s => s.AllTypes()。AllIndices()....

c# elasticsearch nest querydsl
1个回答
1
投票
MatchPhrasePrefix查询

必须

© www.soinside.com 2019 - 2024. All rights reserved.