如何使用org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder在java中映射多字段

时间:2016-01-14 07:44:42

标签: elasticsearch elasticsearch-java-api

我希望用java完全相同的reference_link映射。

1 个答案:

答案 0 :(得分:1)

我找到了解决方案,我所做的是: 上面的其他代码(从头开始): - <QUESTION DATAFIELD="FolderID" REQUIRED="1" HELP="0" HIDDEN="1" PROVIDELOOKUP="0" TYPE="SELECT"><SECTIONBREAK /><HEADING>Organization</HEADING> <DEFAULTANSWER> <SOURCE>SQL</SOURCE> <VALUE> <![CDATA[IF EXISTS(SELECT inodeid as sValue, sorgpath as sText FROM OrgTree o INNER JOIN Locations L ON L.NodeID = o.inodeid WHERE o.sType = 'Folder') BEGIN SELECT sValue, sText FROM ( SELECT '' AS sValue, '' AS sText UNION SELECT CAST(inodeid AS varchar(50)) as sValue, sorgpath as sText FROM OrgTree o INNER JOIN Locations L ON L.NodeID = o.inodeid WHERE o.sType = 'Folder' ) t ORDER BY sText END ELSE BEGIN SELECT sValue, sText FROM ( SELECT '' AS sValue, '' AS sText UNION SELECT CAST(inodeid AS varchar(50)) AS sValue, sOrgPath AS sText FROM OrgTree WHERE sOrgPath LIKE (SELECT sOrgPath FROM OrgTree WHERE INodeID = 1)+'%' AND sType = 'Folder' ) t ORDER BY sText END]]> </VALUE> </DEFAULTANSWER> <ERRORTEXT>* Required</ERRORTEXT> <LABEL /> <TOOLTIP /> <COMMENT /> <METRICSCHECKCOLUMN /> <METRICSCHECKCONTROL /> <SECONDARYCHECKBOX /> <SECONDARYCHECKBOXACTION /> </QUESTION> <QUESTION DATAFIELD="sOrgPath" REQUIRED="0" HELP="0" HIDDEN="1" PROVIDELOOKUP="0" TYPE="TEXT"> <SECTIONBREAK> <GROUP>LINKS</GROUP> <QUESTION DATAFIELD="LinkedActions" REQUIRED="0" HELP="0" HIDDEN="0" PROVIDELOOKUP="0" TYPE=""> <SECTIONBREAK /> <DEFAULTANSWER> <SOURCE /> <VALUE></VALUE> </DEFAULTANSWER> <ERRORTEXT /> <LABEL /> <TOOLTIP /> <COMMENT /> <METRICSCHECKCOLUMN /> <METRICSCHECKCONTROL /> <SECONDARYCHECKBOX /> <SECONDARYCHECKBOXACTION /> </QUESTION> <HTML> <![CDATA[]]> <COMMENT /> </HTML> </SECTIONBREAK> 然后结束代码。