简体   繁体   中英

How does creating an inverted index (equivalent of MongoDB's index) in elasticsearch look?

I'm completely new to Elasticsearch

I know that elasticsearch's indexes are not mongobd's indexes , they are like mongodb's collections

I have some indexes in elasticsearch ( equivalent of MongoDB's collections ) and I want to make sure specific fields in them are going to be indexed (speed of retrieving them will be improved etc).

How do I do it?

In mongodb it was pretty simple since I could use createindex() and ensureindex() methods on a collection , for example :

db.collection1.createIndex({pancake_id: 1, pancakenumber: 1}, {unique: true}) db.collection1.ensureIndex({"eventbegindate": 1, "bike_id": 1})

How do I achieve the same thing in elasticsearch?

Are there any equivalents to these functions?

Thank you in advance , elasticsearch's documentation seems unclear to me.

you have to create index and type as below:

PUT /{index}/{type}/{id}
{
  "field": "value",
  ...
}

it will index documents

And disable "include_in_all" to false for index certain fields

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM