zoukankan      html  css  js  c++  java
  • Elasticsearch.Net

    今天使用Elasticsearch作开发,很简单的查询,就出现Elasticsearch.Net.UnexpectedElasticsearchClientException异常,看样子像是序列化的异常,但实则是Elasticsearch服务器版本和C#用的Elasticsearch.Net客户端版本不匹配导致!

    感谢某位仁兄在这篇博客https://www.cnblogs.com/yswenli/p/6266569.html#4387519中答复某位网友遇到同样的问题

    var searchResponse = client.Search<LogModel>(s => s
                .Query(q => q
                .Match(m => m
                .Field(f => f.D)
                .Query(“Hello world”))));

    Elasticsearch.Net.UnexpectedElasticsearchClientException:“Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Int64' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly.
    To fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
    Path 'hits.total.value', line 1, position 113.”

    内部异常:

    JsonSerializationException: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Int64' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly.
    To fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
    Path 'hits.total.value', line 1, position 113.

  • 相关阅读:
    边框的作用之产生相对margin
    css3 实现切换显示隐藏效果
    Vue 获取数据、事件对象、todolist
    Vue 双向数据绑定、事件介绍以及ref获取dom节点
    Vue 目录结构分析 数据绑定 绑定属性 循环渲染数据 数据渲染
    Vue 安装环境创建项目
    进程&线程
    生成Excel
    JQuery input file 上传图片
    0908期 HTML 样式表属性
  • 原文地址:https://www.cnblogs.com/iDream2018/p/12371911.html
Copyright © 2011-2022 走看看