Method: Cloudant::Client#create_new_index

Defined in:
lib/cloudant/client.rb

#create_new_index(args) ⇒ Object

If only a name is provided the default index doc is “text”,“index”: {} The default index, {}, will index all fields in all docs. This may take a long time with large databases.



143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/cloudant/client.rb', line 143

def create_new_index(args)
  new_index = {}
  
  args[:index] ? new_index["index"] = args[:index] : new_index["index"] = {}
  
  new_index["name"] = args[:name] if args[:name]
  new_index["ddoc"] = args[:ddoc] if args[:ddoc]

  args[:type] ? new_index["type"] = args[:type] : new_index["type"] = "text"

  new_index
end