elasticsearch-plugin

elasticsearch dynamic query - Add another field to each document returned

谁都会走 提交于 2021-02-06 09:26:07
问题 What I need is very simple, but I am unable to find how to do it in Elasticsearch, possibly because of the complexity of what is required to be done. Input (two sample JSON documents) { "car" : 150, "bike" : 300 } { "car" : 100, "bike" : 200} What I want in return is that when I fire a search query it returns me the documents with an extra field inventory which is defined as the sum of number of cars and bikes. And in the sorted order. Sample Output: hits: [ { "car" : 150, "bike" : 300,

Joining two indexes in Elastic Search like a table join

痴心易碎 提交于 2021-01-28 21:14:42
问题 I am relatively new to this elastic search. So, I have an index called post which contain documents like this: { "id": 1, "link": "https:www.instagram.com/p/XXXXX/", "profile_id": 11, "like_count": 100, "comment_count": 12 } I have another index called profile which contain documents like this: { "id": 11, "username": "superman", "name": "Superman", "followers": 12312 } So, as you guys can see, I have all profiles data under the index called profile and all posts data under the index called

Reindex API vs using logstash for reindexing from elastic search 5.5 (remote) to elastic search 7.7 (local)

冷暖自知 提交于 2020-06-29 06:43:31
问题 I am looking for migrating the data from elastic search version 5.5 to 7.7, I found the following two ways, 1) Re_Index API using Java API : https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-document-reindex.html#java-rest-high-document-reindex which looks easy (as it involves java code) and able to see all the possible cases for moving all the documents from version 5.5 to 7.7 2) Re_Index API using Curl : https://www.elastic.co/guide/en/elasticsearch

How to give different weights to exact, phonetic and fuzzy queries?

主宰稳场 提交于 2020-04-17 22:37:10
问题 Note: I checked out this answer, but could not solve the problem. So currently I am using the following query: { "_source": [ "title", "bench", "id_", "court", "date" ], "size": 15, "from": 0, "query": { "bool": { "must": { "multi_match": { "query": "knife", "fields": [ "title", "body" ], "operator": "and" } }, "should": { "multi_match": { "query": "knife", "fields": [ "title", "body" ], "fuzziness" : 1, "operator": "and" } } } }, "highlight": { "pre_tags": [ "<tag1>" ], "post_tags": [ "<

Boolean Query with Elasticsearch

流过昼夜 提交于 2020-03-25 12:31:19
问题 I am currently using the following query - { "_source": [ "title", "bench", "id_", "court", "date", "content" ], "size": 15, "from": 0, "query": { "bool": { "must": [ { "multi_match": { "query": "the", "fields": [ "content" ], "operator": "and" } }, ], "should": { "multi_match": { "query": "the", "fields": [ "content.standard^2" ], "operator": "and" } } } } , "highlight": { "pre_tags": [ "<tag1>" ], "post_tags": [ "</tag1>" ], "fields": { "content": {} }, "fragment_size": 100 } } With the

Tools to migrate index from elasticsearch 1.x to elasticsearch 2.x

风格不统一 提交于 2020-01-26 03:11:05
问题 I am looking for the tools to migrate data from 1.x to 2.x elasticsearch. Please suggest if anything is available? 回答1: You have a few options. You can use Logstash in order to copy indices from your old 1.x ES to your new 2.x ES: input { elasticsearch { hosts => ["old-es:9200"] <--- source ES host index => "source_index" <--- source index to copy docinfo => true } } filter { mutate { remove_field => [ "@version", "@timestamp" ] <--- remove added junk } } output { elasticsearch { hosts => [

How to write mappings in elsaticsearch for geopoint having lat lon and alt?

你离开我真会死。 提交于 2020-01-25 18:44:46
问题 My_Json_File { "addressInfo": { "city": "Wimsheim", "postcode": "71299", "geopoint": { "lon": 48.845877, "lat": 8.821861, "alt": 0.0 } }, "_id": "ac169008-aa5b-4b09-aa9e-3bf3018f316d" } Pls give suggestion on how encounter this "alt" field in geopoint and "_id" field and also write a suitable mappings for above JSON file. Update 1 My_Json_File { "_id": "ac169008-aa5b-4b09-aa9e-3bf3018f316d" "addressInfo": { "city": "Wimsheim", "postcode": "71299", "geopoint": { "lon": 48.845877, "lat": 8