Importing and updating data in Elasticsearch

前端 未结 3 587
暗喜
暗喜 2020-12-14 09:07

We have an existing search function that involves data across multiple tables in SQL Server. This causes a heavy load on our DB, so I\'m trying to find a better way to searc

相关标签:
3条回答
  • 2020-12-14 09:34

    Have you tried changing the config to this:

    filter {
      csv {
        columns => ["_id","postal_code","address_1","city","state_code"]
        separator => "|"
      }
    }
    

    By naming property_id as _id it should get used during indexing.

    0 讨论(0)
  • 2020-12-14 09:36

    Converting from comment:

    You can overwrite a document by sending another document with the same ID... but that might be tricky with your previous data, since you'll get randomized IDs by default.

    You can set an ID using the output plugin's document_id field, but it takes a literal string, not a field name. To use a field's contents, you could use an sprintf format string, such as %{property_id}.

    Something like this, for example:

    output {
      elasticsearch {
        ... other settings...
        document_id => "%{property_id}"
      }
    }
    
    0 讨论(0)
  • 2020-12-14 09:45

    declaimer - I'm the author of ESL
    You can use elasticsearch_loader to load psv files into elasticsearch.
    In order to set the _id field you can use --id-field=property_id. for instance:
    elasticsearch_loader --index=myindex --type=mytype --id-field=property_id csv --delimiter='|' filename.csv

    0 讨论(0)
提交回复
热议问题