Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
96 views
in Technique[技术] by (71.8m points)

Create a CRUD with ElasticSearch?

I have the following indices

categories_v1

this index returns the following

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "categories_v1",
        "_type" : "_doc",
        "_id" : "1124",
        "_score" : 1.0,
        "_source" : {
          "@version" : "1",
          "category_id" : 1124,
          "canonical" : "muebles de dormitorio",
          "@timestamp" : "2021-01-19T21:29:51.672Z",
          "alias" : "muebles de dormitorio"
        }
      },
      {
        "_index" : "categories_v1",
        "_type" : "_doc",
        "_id" : "1126",
        "_score" : 1.0,
        "_source" : {
          "@version" : "1",
          "category_id" : 1126,
          "canonical" : "muebles de oficina",
          "@timestamp" : "2021-01-19T21:29:51.672Z",
          "alias" : "muebles de oficina"
        }
      },
      {
        "_index" : "categories_v1",
        "_type" : "_doc",
        "_id" : "1128",
        "_score" : 1.0,
        "_source" : {
          "@version" : "1",
          "category_id" : 1128,
          "canonical" : "muebles de vestíbulo",
          "@timestamp" : "2021-01-19T21:29:51.673Z",
          "alias" : "muebles de vestíbulo"
        }

this is second index where it indicates the category levels

enter image description here

return the next

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "category_levels_v1",
        "_type" : "_doc",
        "_id" : "1124",
        "_score" : 1.0,
        "_source" : {
          "name" : "muebles de dormitorio",
          "level" : 1,
          "category_id" : 1124,
          "@version" : "1",
          "@timestamp" : "2021-01-19T21:29:52.538Z",
          "parent_path" : "1123/1124"
        }
      },
      {
        "_index" : "category_levels_v1",
        "_type" : "_doc",
        "_id" : "3156",
        "_score" : 1.0,
        "_source" : {
          "name" : "audio y video portátil",
          "level" : 1,
          "category_id" : 3156,
          "@version" : "1",
          "@timestamp" : "2021-01-19T21:29:52.550Z",
          "parent_path" : "3150/3156"
        }
      },
      {
        "_index" : "category_levels_v1",
        "_type" : "_doc",
        "_id" : "3158",
        "_score" : 1.0,
        "_source" : {
          "name" : "televisión y vídeo",
          "level" : 1,
          "category_id" : 3158,
          "@version" : "1",
          "@timestamp" : "2021-01-19T21:29:52.555Z",
          "parent_path" : "3150/3158"
        }
      },

and finally I have the product index, where it already makes the relationship and shows the product detail

enter image description here

It returns the following result

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "productos_v1",
        "_type" : "_doc",
        "_id" : "41552626",
        "_score" : 1.0,
        "_source" : {
          "@version" : "1",
          "height" : 0,
          "cat_level_1" : "Perros",
          "title" : "Escaleras y pelda?os, Kuke Escalera para mascotas 3 Pasos Gato Perro Rampa Escaleras de plástico Marco Escaleras para mascotas de juguete (Tiempo de entrega: 3-10 días)",
          "cat_level_3" : "Sillones y sillas para perros",
          "price" : 175657.53,
          "category_id" : 2975332011,
          "@timestamp" : "2021-01-16T15:33:20.665Z",
          "cat_level_0" : "Animales y Mascotas",
          "fullname" : "Animales y Mascotas/Perros/Camas y muebles para perros/Sillones y sillas para perros",
          "product_id" : 41552626,
          "title_ots" : "sillones y sillas perros, escaleras pelda?os, kuke escalera mascotas 3 pasos gato perro rampa plástico marco juguete (tiempo entrega: 3-10 días)",
          "rating" : 0,
          "cat_level_2" : "Camas y muebles para perros",
          "image" : "https://images-na.ssl-images-amazon.com/images/I/41GLnB1b0lL.jpg",
          "relevance" : 47.0,
          "model" : "",
          "brand" : "Kuke",
          "bestseller" : 0,
          "sales_quantity" : 0,
          "color" : "Sincolor",
          "is_prime" : 1,
          "category_name" : "Sillones y sillas para perros",
          "weight" : 0
        }
      },

So far perfect, by necessity in indexing times, which takes approximately 27 hours to upload 18.4 million records, the idea arose of building a crud to be able to add a product, search, delete

I am a newbie in this of the indices, could you give me any recommendation or example to guide me and know where to start?

question from:https://stackoverflow.com/questions/65835100/create-a-crud-with-elasticsearch

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...