elasticsearch-query

Needs to return only the matched nested objects with full parent body in Elasticsearch

依然范特西╮ 提交于 2019-12-22 00:24:18
问题 I am using Elastic search version 1.7 in my project. I have a an index named colleges and under this index there is a nested index name courses like this. { "name": "College Name" "university": "University Name", "city": 429, "city_name": "London", "state": 328, "state_name": "London", "courses": [ { "id": 26, "degree_name": "Master Of Technology", "annual_fee": 100000, "stream": "Engineering", "degree_id": 9419 }, { "id": 28, "degree_name": "Master Of Philosophy", "annual_fee": 100000,

How can i do a multiple search query within a single URI in ElasticSearch?

只谈情不闲聊 提交于 2019-12-13 06:30:49
问题 I'm trying to get results of an index, by sending an GET http call from Postman for both date range and for a field ("log_type") which I added manually, So for now I'm able to get the results, when i query it individually such as: Date Range: http://localhost:9200/dialog_test/_search?q=timestamp:[2016-08-05+TO+2016-08-06] log_type: http://localhost:9200/dialog_test/_search?q=log_type:GetProvisioning%20SUCCESS In the url above (log_type), GetProvisioning Success is a log_type. So what I wanted

Elasticsearch : Search with special character Open & Close parentheses

风流意气都作罢 提交于 2019-12-13 03:47:51
问题 Hi I am trying to search a word which has these characters in it '(' , ')' in elastic search. I am not able to get expected result. This is the query I am using { "query": { "query_string" : { "default_field" : "name", "query" : "\\(Pas\\)ta\"" } }} In the results I am getting records with "PASTORS" , "PAST", "PASCAL", "PASSION" first. I want to get name 'Pizza & (Pas)ta' in the first record in the search result as it is the best match . Here is the analyzer for the name field in the schema

How to sort data by _version in ElasticSearch

情到浓时终转凉″ 提交于 2019-12-13 02:02:09
问题 As I am able to sort data using score like { "version":true, "_source":false, "sort": [ { "_score": { "order": "desc" } } ], "query": { "match_all": {} } } Please let me know How can I do the same with _version. By default Fielddata is not supported on field _version. So may be I am missing some thing. Is there any specific setting to query with version? Please help! 回答1: You can't do this, and usually you don't have to. See this thread: https://discuss.elastic.co/t/filter-by--version-and

Searching nested documents for a field regardless of the positioning of the field

被刻印的时光 ゝ 提交于 2019-12-13 00:06:05
问题 Consider a document in Elasticsearch like this: { "id": 1, "Comment": "Comment text", "Reply": [{ "id": 2, "Comment": "Nested comment text", }, { "id": 3, "Comment": "Another nested comment text", }] } I want to search for id == 2 without knowing whether it is in the firsts level of the document or in the second. Is this possible? Please also keep in mind that the nested level can be anything (unknown at development time). If this is possible, what's the query to return this document by

Elastic search query find exact match of values in the list from regexp input parameter

亡梦爱人 提交于 2019-12-11 14:49:42
问题 My data looks like below: { "name": "name1", "name_gr": ["gr1","gr2"] }, { "name": "name2", "name_gr": ["gr1","gr2"] }, { "name": "name3", "name_gr": ["gr2","gr3"] }, { "name": "name4", "name_gr": ["gr1","gr2","gr3","gr4"] }, { "name": "name4", "name_gr": ["gr4","gr5"] } Now, i am trying to write elastic search query using elasticsearch_dsl python module by importing Q from it. My input query will be some regex on "name_gr" . For eg: "name_gr": "gr[12]" . So, in this case I want all the names

How to make union query on Elasticsearch?

我的梦境 提交于 2019-12-05 12:47:31
I would like to make a query with UNION and limit. I can explain that query on mysql. (SELECT * FROM table WHERE type='text' LIMIT 3 ) UNION (SELECT * FROM table WHERE type='word' LIMIT 3 ) I tried it on Elasticsearch { "query":{ "dis_max":{ "queries":[ { "from":0, "size":3, "query":{ "match":{ "type":"text" } } }, { "from":0, "size":3, "query":{ "match":{ "type":"word" } } } ] } } } http://localhost:9200/test/table/_search?pretty&source= {%22query%22:{%22dis_max%22:{%22queries%22:[{%22query%22:{%22match%22:{%22type%22:%22test%22}}}]}}} Then, the error occured. { "error" : { "root_cause" : [ {

Needs to return only the matched nested objects with full parent body in Elasticsearch

和自甴很熟 提交于 2019-12-04 18:59:46
I am using Elastic search version 1.7 in my project. I have a an index named colleges and under this index there is a nested index name courses like this. { "name": "College Name" "university": "University Name", "city": 429, "city_name": "London", "state": 328, "state_name": "London", "courses": [ { "id": 26, "degree_name": "Master Of Technology", "annual_fee": 100000, "stream": "Engineering", "degree_id": 9419 }, { "id": 28, "degree_name": "Master Of Philosophy", "annual_fee": 100000, "stream": "Philosophy", "degree_id": 9420 } ] } What I am doing is that I am trying to filter the the

How could I have MySQL IN clause within my elasticsearch query?

冷暖自知 提交于 2019-12-02 17:23:18
问题 I'm trying perform an elasticsearch query as a GET request in order pull data from the index which I created. The data which is in the index is, a table from MySQL DB, configured though logstash . Here is my request without the IN clause: http://localhost:9200/response_summary/_search?q=api:"location"+AND+transactionoperationstatus:"charged"+AND+operatorid='DIALOG'+AND+userid:test+AND+time:"2015-05-27" In the above, I should be able to append AND responseCode IN (401,403) . I tried giving it

How to handle wildcards in elastic search structured queries

ε祈祈猫儿з 提交于 2019-12-02 15:28:41
问题 My use case requires to query for our elastic search domain with trailing wildcards. I wanted to get your opinion on the best practices of handling such wildcards in the queries. Do you think adding the following clauses is a good practice for the queries: "query" : { "query_string" : { "query" : "attribute:postfix*", "analyze_wildcard" : true, "allow_leading_wildcard" : false, "use_dis_max" : false } } I've disallowed leading wildcards since it is a heavy operation. However I wanted to how