elasticsearch无法从字符串转换为elasticclient.searchrequestparameters

lpwwtiir  于 2021-06-14  发布在  ElasticSearch
关注(0)|答案(1)|浏览(357)

这是json变量,这个过滤器在kibana dashbaord中运行良好,下面是它的屏幕截图

我的要求是,想要得到相同的输出,我从kibana使用过滤器查询ElasticSearch点网搜索请求这里是我从堆栈溢出到现在得到的点的链接

{
                      ""version"": true,
                      ""size"": 500,
                      ""sort"": [
                        {
                            ""AddedOn"": {
                            ""order"": ""desc"",
                            ""unmapped_type"": ""boolean""
                                          }
                        }
                                    ],
                            ""stored_fields"": [
                                    ""*""
                                               ],
                            ""script_fields"": { },
                            ""docvalue_fields"": [
                                    {
                            ""field"": ""@timestamp"",
                            ""format"": ""date_time""
                                    },
                                    {
                             ""field"": ""AddedOn"",
                             ""format"": ""date_time""
                                    }
                                  ],
                             ""_source"": {
                             ""excludes"": []
                                  },
                             ""query"": {
                             ""bool"": {
                             ""must"": [],
                             ""filter"": [
                                        {
                             ""match_all"": { }
                                         },
                                        {
                             ""match_all"": { }
                                         },
                                        {
                              ""bool"": {
                              ""filter"": [
                                            {
                              ""match_all"": { }
                                            },
                                              {
                              ""match_all"": { }
                                              },
                                              {
                              ""range"": {
                              ""AddedOn"": {
                              ""format"": ""strict_date_optional_time"",
                              ""gte"": ""2019-10-26T09:20:14.087Z"",
                              ""lte"": ""2020-10-26T09:20:14.087Z""
                                          }
                                          }
                                          }
                                            ],
                                            ""must"": [],
                                            ""must_not"": [],
                                            ""should"": []
                                          }
                                             },
                                        {
                                         ""range"": {
                                         ""AddedOn"": {
                                         ""gte"": ""2019-10-26T10:38:34.169Z"",
                                         ""lte"": ""2020-10-26T10:38:34.170Z"",
                                         ""format"": ""strict_date_optional_time""
                                                                    }
                                                                }
                                                            }
                                      ],
                                      ""should"": [],
                                      ""must_not"": []
                                    }
                                                    },
                                  ""highlight"": {
                                                        ""pre_tags"": [
                                                          ""@kibana-highlighted-field@""
                                    ],
                                    ""post_tags"": [
                                      ""@/kibana-highlighted-field@""
                                    ],
                                    ""fields"": {
                                                            ""*"": { }
                                                        },
                                    ""fragment_size"": 2147483647
                                  }
                                                }
                                "

这是在elasticsearch索引中进行搜索的代码

_elasticClient.LowLevel.Search<SearchResponse<object>>(FraudIndex, "type", json4); >>> The errror i am getting is that cannot convert from string to ElasticClient.searchRequestparameters
2nbm6dog

2nbm6dog1#

这就是找到的解决办法

var SearchResponse =await_elasticClient.LowLevel.SearchAsync<SearchResponse<object>>(FraudIndex, json4);

相关问题