fluid-api/src/main/java/com/fluidbpm/program/api/vo/field/Field.java
@Override
	@XmlTransient
	public JSONObject toJsonForElasticSearch() throws JSONException {

		if(!this.doesFieldQualifyForElasticSearchInsert())
		{
			return null;
		}

		JSONObject returnVal = new JSONObject();

		String fieldIdAsString = this.getFieldNameAsUpperCamel();
		Object fieldValue = this.getFieldValue();

		//Table Field...
		if(fieldValue instanceof TableField)
		{
			TableField tableField = (TableField)this.getFieldValue();

			if(tableField.getTableRecords() != null &&
					!tableField.getTableRecords().isEmpty())
			{
				JSONArray array = new JSONArray();
				for(Form record : tableField.getTableRecords())
				{
					if(record.getId() == null)
					{
						continue;
					}

					array.put(record.getId());
				}

				returnVal.put(fieldIdAsString, array);
			}
		}
		//Multiple Choice...
		else if(fieldValue instanceof MultiChoice)
		{
			MultiChoice multiChoice = (MultiChoice)this.getFieldValue();

			if(multiChoice.getSelectedMultiChoices() != null &&
					!multiChoice.getSelectedMultiChoices().isEmpty())
			{
				JSONArray array = new JSONArray();

				for(String selectedChoice : multiChoice.getSelectedMultiChoices())
				{
					Long selectedChoiceAsLong = null;

					try{
						if(!selectedChoice.isEmpty() &&
								Character.isDigit(selectedChoice.charAt(0)))
						{
							selectedChoiceAsLong = Long.parseLong(selectedChoice);
						}
					}
					catch (NumberFormatException nfe)
					{
						selectedChoiceAsLong = null;
					}

					//When not long, store as is...
					if(selectedChoiceAsLong == null)
					{
						array.put(selectedChoice);
					}
					else
					{
						array.put(selectedChoiceAsLong.longValue());
					}
				}

				returnVal.put(fieldIdAsString, array);
			}
		}
		//Other valid types...
		else if((fieldValue instanceof Number || fieldValue instanceof Boolean) ||
				fieldValue instanceof String)
		{
			if((fieldValue instanceof String) && LATITUDE_AND_LONGITUDE.equals(this.getTypeMetaData())) {
				String formFieldValueStr = fieldValue.toString();

				UtilGlobal utilGlobal = new UtilGlobal();

				String latitude = utilGlobal.getLatitudeFromFluidText(formFieldValueStr);
				String longitude = utilGlobal.getLongitudeFromFluidText(formFieldValueStr);

				fieldValue = (latitude.concat(UtilGlobal.COMMA).concat(longitude));
			}

			returnVal.put(fieldIdAsString, fieldValue);
		}
		//Date...
		else if(fieldValue instanceof Date)
		{
			returnVal.put(fieldIdAsString, ((Date)fieldValue).getTime());
		}
		//Problem
		else {
			throw new FluidElasticSearchException(
					"Field Value of field-type '"+fieldValue.getClass().getSimpleName()
							+"' and Value '"+ fieldValue+"' is not supported.");
		}

		return returnVal;
	}
@Override
	@XmlTransient
	public JSONObject toJsonForElasticSearch() throws JSONException {

		if(!this.doesFieldQualifyForElasticSearchInsert())
		{
			return null;
		}

		JSONObject returnVal = new JSONObject();

		String fieldIdAsString = this.getFieldNameAsUpperCamel();
		Object fieldValue = this.getFieldValue();

		//Table Field...
		if(fieldValue instanceof TableField)
		{
			TableField tableField = (TableField)this.getFieldValue();

			if(tableField.getTableRecords() != null &&
					!tableField.getTableRecords().isEmpty())
			{
				JSONArray array = new JSONArray();
				for(Form record : tableField.getTableRecords())
				{
					if(record.getId() == null)
					{
						continue;
					}

					array.put(record.getId());
				}

				returnVal.put(fieldIdAsString, array);
			}
		}
		//Multiple Choice...
		else if(fieldValue instanceof MultiChoice)
		{
			MultiChoice multiChoice = (MultiChoice)this.getFieldValue();

			if(multiChoice.getSelectedMultiChoices() != null &&
					!multiChoice.getSelectedMultiChoices().isEmpty())
			{
				JSONArray array = new JSONArray();

				for(String selectedChoice : multiChoice.getSelectedMultiChoices())
				{
					Long selectedChoiceAsLong = null;

					try{
						if(!selectedChoice.isEmpty() &&
								Character.isDigit(selectedChoice.charAt(0)))
						{
							selectedChoiceAsLong = Long.parseLong(selectedChoice);
						}
					}
					catch (NumberFormatException nfe)
					{
						selectedChoiceAsLong = null;
					}

					//When not long, store as is...
					if(selectedChoiceAsLong == null)
					{
						array.put(selectedChoice);
					}
					else
					{
						array.put(selectedChoiceAsLong.longValue());
					}
				}

				returnVal.put(fieldIdAsString, array);
			}
		}
		//Other valid types...
		else if((fieldValue instanceof Number || fieldValue instanceof Boolean) ||
				fieldValue instanceof String)
		{
			if((fieldValue instanceof String) && LATITUDE_AND_LONGITUDE.equals(this.getTypeMetaData())) {
				String formFieldValueStr = fieldValue.toString();

				UtilGlobal utilGlobal = new UtilGlobal();

				String latitude = utilGlobal.getLatitudeFromFluidText(formFieldValueStr);
				String longitude = utilGlobal.getLongitudeFromFluidText(formFieldValueStr);

				fieldValue = (latitude.concat(UtilGlobal.COMMA).concat(longitude));
			}

			returnVal.put(fieldIdAsString, fieldValue);
		}
		//Date...
		else if(fieldValue instanceof Date)
		{
			returnVal.put(fieldIdAsString, ((Date)fieldValue).getTime());
		}
		//Problem
		else {
			throw new FluidElasticSearchException(
					"Field Value of field-type '"+fieldValue.getClass().getSimpleName()
							+"' and Value '"+ fieldValue+"' is not supported.");
		}

		return returnVal;
	}
Conversion to {@code JSONObject} for storage in ElasticSearch.

@return {@code JSONObject} representation of {@code Field}
@throws JSONException If there is a problem with the JSON Body.

@see ABaseFluidJSONObject#toJsonObject()