ElasticSearch中的索引对象?

时间:2015-06-11 14:39:25

标签: elasticsearch

我有一个包含很多字段的字典,如果可能的话我想在ElasticSearch里面对它进行索引。我正在使用Python。它可以工作还是ElasticSearch的一个限制,它只能支持简单的数据类型?谢谢!

稍后编辑:我的字典如下所示:

  {
      'lingpipe': Tagging(tagger_id = 'lingpipe', raw_tagging = '', tagger_config = None, tagger_version = None, generation_time = StreamTime(epoch_ticks = 1364699587.0, zulu_timestamp = '2013-03-31T04:13:07.663542Z')),
      'serif': Tagging(tagger_id = 'serif', raw_tagging = '', tagger_config = 'English', tagger_version = '6.1', generation_time = None),
      'stanford': Tagging(tagger_id = 'stanford', raw_tagging = '1\tFree\tFree\tNNP\tO\t23\t27\n2\tBiscayne\tBiscayne\tNNP\tO\t28\t36\n3\tNational\tNational\tNNP\tO\t37\t45\n4\tPark\tPark\tNNP\tO\t46\t50\n5\tGuide\tGuide\tNNP\tO\t51\t56\n6\tGet\tget\tVB\tO\t57\t60\n7\tyour\tyou\tPRP$\tO\t61\t65\n8\tquick\tquick\tJJ\tO\t66\t71\n9\tguide\tguide\tNN\tO\t72\t77\n10\tto\tto\tTO\tO\t78\t80\n11\tthe\tthe\tDT\tO\t81\t84\n12\ttop\ttop\tJJ\tO\t85\t88\n13\thotels\thotel\tNNS\tO\t89\t95\n14\t,\t,\t,\tO\t95\t96\n15\trestaurants\trestaurant\tNNS\tO\t97\t108\n16\tand\tand\tCC\tO\t109\t112\n17\tthings\tthing\tNNS\tO\t113\t119\n18\tto\tto\tTO\tO\t120\t122\n19\tdo\tdo\tVB\tO\t123\t125\n20\t.\t.\t.\tO\t125\t126\n\n1\tGrab\tgrab\tVB\tO\t127\t131\n2\tit\tit\tPRP\tO\t132\t134\n3\tand\tand\tCC\tO\t135\t138\n4\tGo\tgo\tVB\tO\t139\t141\n5\t!\t!\t.\tO\t141\t142', tagger_config = 'annotators: {tokenize, cleanxml, ssplit, pos, lemma, ner}, properties: pos.maxlen=100', tagger_version = 'Stanford CoreNLP ver 1.2.0', generation_time = StreamTime(epoch_ticks = 1338505200.0, zulu_timestamp = '2012-06-01T00:00:00.0Z'))
  }

所以它基本上是数据类型的混合。我还不确定如何序列化它,ES正在抛出序列化错误。如何将此对象转换为JSON?

0 个答案:

没有答案