You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/02/29 03:57:55 UTC

[GitHub] [couchdb] hamedminaee opened a new issue #2618: couchdb and choice of using _design doc or using find api with index: {}

hamedminaee opened a new issue #2618: couchdb and choice of using _design doc or using find api with index: {}
URL: https://github.com/apache/couchdb/issues/2618
 
 
   Currently we use indexing of couch for the fields we need this way:
   
   `function (doc) {
       var facet = true;
       var store = true;
       var fields = {
           'created_by_ref': 'UNDEFINED',
           'last_observed': 'UNDEFINED',
           'user_account.user_id': 'UNDEFINED',
           'url.value': 'UNDEFINED',
           'network_traffic.src_ref': 'UNDEFINED',
           'network_traffic.dst_ref': 'UNDEFINED',
           'network_traffic.src_port': 'UNDEFINED',
           'network_traffic.dst_port': 'UNDEFINED',
           'network_traffic.src_ref.resolves_to_refs': 'UNDEFINED',
           'network_traffic.dst_ref.resolves_to_refs': 'UNDEFINED',
           'x_com_ibm_ariel.qid_name': 'UNDEFINED',
           'x_com_ibm_ariel.log_source_name': 'UNDEFINED',
           'x_com_ibm_ariel.magnitude': 'UNDEFINED',
           'x_com_ibm_ariel.category': 'UNDEFINED',
           'network_traffic.protocols': [],
           'file.name': [],
           'file.hashes.MD5': [],
           'ipv4_addr.value': [],
       }
       if (doc.created_by_ref) {
           fields.created_by_ref = doc['created_by_ref'].substr(10);
       }
       if (doc.last_observed) {
           fields.last_observed = Date.parse(doc.last_observed);
       }`
   
   so the fields to be indexed are predefined but now we need to make that dynamic. So We will mine the fields dynamically which will be an array of 10 or 20 or 100 (up most will be 100)
    So if I get that correctly I have two choices:
   
   1. generate design doc dynamically and insert it to db then what ever doc inserted in to the couch will be indexed
   2. Using find and index { }: https://cloud.ibm.com/docs/services/Cloudant?topic=cloudant-query#the-index-field
   Now I am wondering which way is more performant. To my understanding the first one should be faster because when the doc is inserted (due to couchdb 3 feature which warms up indices gradually or even the first query can start that process) after indexing warm up querying db will be fast since indexing is done or at least started early in the process but in the second case when the query to db happens then indexing starts at this point and it needs to be done then the result will be returned and this can be time consuming and keep the user waiting. Am I right in that? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] wohali closed issue #2618: couchdb and choice of using _design doc or using find api with index: {}

Posted by GitBox <gi...@apache.org>.
wohali closed issue #2618: couchdb and choice of using _design doc or using find api with index: {}
URL: https://github.com/apache/couchdb/issues/2618
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] wohali commented on issue #2618: couchdb and choice of using _design doc or using find api with index: {}

Posted by GitBox <gi...@apache.org>.
wohali commented on issue #2618: couchdb and choice of using _design doc or using find api with index: {}
URL: https://github.com/apache/couchdb/issues/2618#issuecomment-592871357
 
 
   Hi @hamedminaee ,
   
   This is not a CouchDB bug. GitHub is for actual CouchDB bugs only.
   
   If you are looking for general support with using CouchDB, please try one of these other options:
   
   * The user mailing list. Signup instructions are [here](http://couchdb.apache.org/#mailing-lists)
   * The Slack/IRC chat room. Joining instructions are [here](http://couchdb.apache.org/#chat)
   
   Thank you for using CouchDB!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services