Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
courses:cs397:winter2017:elasticsearch [2017/04/16 19:23] – [Limiting Results] admincourses:cs397:winter2017:elasticsearch [2017/04/16 19:26] (current) – [Inserting documents to an index] admin
Line 70: Line 70:
 ==== Aggregations ==== ==== Aggregations ====
  
-curl -XGET 'localhost:9200/bank/_search?pretty' -H 'Content-Type: application/json' -d' +Finding distinct entities 
-+ 
-  "size": 0, +  curl -XGET 'localhost:9200/bank/_search?pretty' -H 'Content-Type: application/json' -d' 
-  "aggs":+  
-    "group_by_state":+    "size": 0, 
-      "terms":+    "aggs":
-        "field": "state.keyword"+      "group_by_state":
 +        "terms":
 +          "field": "state.keyword" 
 +        }
       }       }
     }     }
-  } +  }'
-+
-'+
  
 ===== Adding Information ===== ===== Adding Information =====
Line 95: Line 96:
   curl –XPUT ‘localhost:9200/index/external/newid?pretty’ –d’{“field”:”data”}’   curl –XPUT ‘localhost:9200/index/external/newid?pretty’ –d’{“field”:”data”}’
  
 +
 +==== Adding from a File ====
 +
 +  mongoimport --db dbname --collection whichcollection --file mydata.json
 +
 +  curl -XPOST 'http://localhost:9200/dbname' -d @mydata.json
 +
 +  curl -XPOST 'http://localhost:9200/dbname/_bulk' —data-binary @mydata.json
 +===== Deleting Information =====
 +
 +  curl -XDELETE 'localhost:9200/students?pretty'
  
courses/cs397/winter2017/elasticsearch.1492370582.txt.gz · Last modified: 2017/04/16 19:23 by admin
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0