首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >elasticsearch json java api

问elasticsearch json java api
EN

Stack Overflow用户
提问于 2014-04-01 15:26:26
回答 1查看 4.3K关注 0票数 1

我正在尝试将elasticsearch与android应用程序集成。

我需要获取jsonobject并打印出每个id的详细信息。首先,我需要尝试编写java类。

我可以只使用json还是有一个更简单的elasticsearch。

网址:http://www.dummy.com:9200/contacts/index/_search

代码语言:javascript
复制
{
  "took": 10,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 2,
    "max_score": 1.0,
    "hits": [
      {
        "_index": "contacts",
        "_type": "index",
        "_id": "2",
        "_score": 1.0,
        "_source": {
          "id": "c201",
          "name": "Johnny Depp",
          "email": "johnny_depp@gmail.com",
          "address": "xx-xx-xxxx,x - street, x - country",
          "gender": "male",
          "phone": {
            "mobile": "+91 0000000000",
            "home": "00 000000",
            "office": "00 000000"
          }
        }
      },
      {
        "_index": "contacts",
        "_type": "index",
        "_id": "1",
        "_score": 1.0,
        "_source": {
          "id": "c200",
          "name": "Ravi Tamada",
          "email": "ravi@gmail.com",
          "address": "xx-xx-xxxx,x - street, x - country",
          "gender": "male",
          "phone": {
            "mobile": "+91 0000000000",
            "home": "00 000000",
            "office": "00 000000"
          }
        }
      }
    ]
  }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-01 16:00:03

有几种方法可以将JSON对象挂起。让它像字符串一样手动,使用MAP.And是的,ES中有一个助手类,它是XContentBuilder .for关于该@请参阅的更多信息。

根据我的考虑,它更好地使用任何JSON来创建一个有效的对象,并且易于使用.请参阅

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22790222

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档