Elastic Search: How to extract All “FieldNames” that Match the Query Phrase/Stringelastic search matching issueElastic search does not return query result for indexed fieldElastic Search: find document by analyzed field only if all words from field are contained in queryElastic search nest search queryElastic search nest dynamic query with object initializer NEST 5.xMatchphrase Query Elastic Search not working as expectedc# nest for elasticsearch: how to convert query that updates particular field of elastic search document to nest?Elastic search query from JSON formatted string?Elastic Search nested object queryElastic Search MoreLikeThis Query Never Returns Results

AsyncDictionary - Can you break thread safety?

Is this n-speak?

ParseJSON using SSJS

On math looking obvious in retrospect

PhD advisor lost funding, need advice

How far did Gandalf and the Balrog drop from the bridge in Moria?

Is it okay for a ticket seller in the USA to refuse to give you your change, keep it for themselves and claim it's a tip?

What ability do tools use?

Heating Margarine in Pan = loss of calories?

Why I have higher ping to the VLAN interface than to other local interfaces

How to remove threat that antivirus program indicates has to be manually deleted?

Bitcoin successfully deducted on sender wallet but did not reach receiver wallet

The cat ate your input again!

How to describe accents?

How can Radagast come across Gandalf and Thorin's company?

How do some PhD students get 10+ papers? Is that what I need for landing good faculty position?

how do companies get money from being listed publicly

is this F 6'9 chord a figured bass or a chord extension?

Can sampling rate be a floating point number?

First amendment and employment: Can a police department terminate an officer for speech?

Why are Gatwick's runways too close together?

Is it legal for a company to enter an agreement not to hire employees from another company?

Why did I get only 5 points even though I won?

How to take the beginning and end parts of a list with simpler syntax?



Elastic Search: How to extract All “FieldNames” that Match the Query Phrase/String


elastic search matching issueElastic search does not return query result for indexed fieldElastic Search: find document by analyzed field only if all words from field are contained in queryElastic search nest search queryElastic search nest dynamic query with object initializer NEST 5.xMatchphrase Query Elastic Search not working as expectedc# nest for elasticsearch: how to convert query that updates particular field of elastic search document to nest?Elastic search query from JSON formatted string?Elastic Search nested object queryElastic Search MoreLikeThis Query Never Returns Results






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-1















I want to extract the field names where the search text appears in the elastic search (stored) indexed documents.



Is this type of querying possible in elastic search, I am using Nest Client in C#



Please refer to the example below:



Example: employee document

"first_name" : "emp first",
"last_name" : "emp last"



Input search text: "first"
Expected out : ["first_name"]



Input search text : "emp"
Expected output : ["first_name", "last_name"]



Thanks,
AT










share|improve this question






























    -1















    I want to extract the field names where the search text appears in the elastic search (stored) indexed documents.



    Is this type of querying possible in elastic search, I am using Nest Client in C#



    Please refer to the example below:



    Example: employee document

    "first_name" : "emp first",
    "last_name" : "emp last"



    Input search text: "first"
    Expected out : ["first_name"]



    Input search text : "emp"
    Expected output : ["first_name", "last_name"]



    Thanks,
    AT










    share|improve this question


























      -1












      -1








      -1








      I want to extract the field names where the search text appears in the elastic search (stored) indexed documents.



      Is this type of querying possible in elastic search, I am using Nest Client in C#



      Please refer to the example below:



      Example: employee document

      "first_name" : "emp first",
      "last_name" : "emp last"



      Input search text: "first"
      Expected out : ["first_name"]



      Input search text : "emp"
      Expected output : ["first_name", "last_name"]



      Thanks,
      AT










      share|improve this question














      I want to extract the field names where the search text appears in the elastic search (stored) indexed documents.



      Is this type of querying possible in elastic search, I am using Nest Client in C#



      Please refer to the example below:



      Example: employee document

      "first_name" : "emp first",
      "last_name" : "emp last"



      Input search text: "first"
      Expected out : ["first_name"]



      Input search text : "emp"
      Expected output : ["first_name", "last_name"]



      Thanks,
      AT







      c# elasticsearch lucene nest






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 9:01









      aditya eceaditya ece

      12 bronze badges




      12 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1














          There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names



          For your case you can use this query



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name":
          "query": "emp",
          "_name": "first_name"


          ,

          "match":
          "last_name":
          "query": "emp",
          "_name": "last_name"



          ]





          Elasticsearch will return result like this one




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "matched_queries": [
          "first_name",
          "last_name"
          ]

          ]




          You can also do the same thing with highlighting



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name": "emp"

          ,

          "match":
          "last_name": "emp"


          ]

          ,
          "highlight":
          "fields":
          "first_name": ,
          "last_name" :





          Sample Response :




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "highlight": [
          "first_name" : ["<em>emp</em> first"],
          "last_name" : ["<em>emp</em> last"]
          ]

          ]







          share|improve this answer



























          • Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.

            – aditya ece
            Mar 29 at 8:44












          • @adityaece Yes. You can also do it with the highlighting

            – Ashraful Islam
            Mar 29 at 8:58










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373265%2felastic-search-how-to-extract-all-fieldnames-that-match-the-query-phrase-stri%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names



          For your case you can use this query



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name":
          "query": "emp",
          "_name": "first_name"


          ,

          "match":
          "last_name":
          "query": "emp",
          "_name": "last_name"



          ]





          Elasticsearch will return result like this one




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "matched_queries": [
          "first_name",
          "last_name"
          ]

          ]




          You can also do the same thing with highlighting



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name": "emp"

          ,

          "match":
          "last_name": "emp"


          ]

          ,
          "highlight":
          "fields":
          "first_name": ,
          "last_name" :





          Sample Response :




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "highlight": [
          "first_name" : ["<em>emp</em> first"],
          "last_name" : ["<em>emp</em> last"]
          ]

          ]







          share|improve this answer



























          • Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.

            – aditya ece
            Mar 29 at 8:44












          • @adityaece Yes. You can also do it with the highlighting

            – Ashraful Islam
            Mar 29 at 8:58















          1














          There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names



          For your case you can use this query



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name":
          "query": "emp",
          "_name": "first_name"


          ,

          "match":
          "last_name":
          "query": "emp",
          "_name": "last_name"



          ]





          Elasticsearch will return result like this one




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "matched_queries": [
          "first_name",
          "last_name"
          ]

          ]




          You can also do the same thing with highlighting



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name": "emp"

          ,

          "match":
          "last_name": "emp"


          ]

          ,
          "highlight":
          "fields":
          "first_name": ,
          "last_name" :





          Sample Response :




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "highlight": [
          "first_name" : ["<em>emp</em> first"],
          "last_name" : ["<em>emp</em> last"]
          ]

          ]







          share|improve this answer



























          • Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.

            – aditya ece
            Mar 29 at 8:44












          • @adityaece Yes. You can also do it with the highlighting

            – Ashraful Islam
            Mar 29 at 8:58













          1












          1








          1







          There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names



          For your case you can use this query



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name":
          "query": "emp",
          "_name": "first_name"


          ,

          "match":
          "last_name":
          "query": "emp",
          "_name": "last_name"



          ]





          Elasticsearch will return result like this one




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "matched_queries": [
          "first_name",
          "last_name"
          ]

          ]




          You can also do the same thing with highlighting



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name": "emp"

          ,

          "match":
          "last_name": "emp"


          ]

          ,
          "highlight":
          "fields":
          "first_name": ,
          "last_name" :





          Sample Response :




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "highlight": [
          "first_name" : ["<em>emp</em> first"],
          "last_name" : ["<em>emp</em> last"]
          ]

          ]







          share|improve this answer















          There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names



          For your case you can use this query



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name":
          "query": "emp",
          "_name": "first_name"


          ,

          "match":
          "last_name":
          "query": "emp",
          "_name": "last_name"



          ]





          Elasticsearch will return result like this one




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "matched_queries": [
          "first_name",
          "last_name"
          ]

          ]




          You can also do the same thing with highlighting



          GET index/doc_type/_search

          "_source": [
          "first_name",
          "last_name"
          ],
          "query":
          "bool":
          "should": [

          "match":
          "first_name": "emp"

          ,

          "match":
          "last_name": "emp"


          ]

          ,
          "highlight":
          "fields":
          "first_name": ,
          "last_name" :





          Sample Response :




          "took": 90,
          "timed_out": false,
          "_shards":
          "total": 5,
          "successful": 5,
          "failed": 0
          ,
          "hits":
          "total": 1,
          "max_score": 16.399673,
          "hits": [

          "_index": "index",
          "_type": "doc_type",
          "_id": "1",
          "_score": 16.399673,
          "_routing": "1",
          "_source":
          "first_name": "emp first",
          "last_name": "emp last"
          ,
          "highlight": [
          "first_name" : ["<em>emp</em> first"],
          "last_name" : ["<em>emp</em> last"]
          ]

          ]








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 29 at 9:04

























          answered Mar 27 at 9:25









          Ashraful IslamAshraful Islam

          9,2152 gold badges22 silver badges37 bronze badges




          9,2152 gold badges22 silver badges37 bronze badges















          • Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.

            – aditya ece
            Mar 29 at 8:44












          • @adityaece Yes. You can also do it with the highlighting

            – Ashraful Islam
            Mar 29 at 8:58

















          • Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.

            – aditya ece
            Mar 29 at 8:44












          • @adityaece Yes. You can also do it with the highlighting

            – Ashraful Islam
            Mar 29 at 8:58
















          Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.

          – aditya ece
          Mar 29 at 8:44






          Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.

          – aditya ece
          Mar 29 at 8:44














          @adityaece Yes. You can also do it with the highlighting

          – Ashraful Islam
          Mar 29 at 8:58





          @adityaece Yes. You can also do it with the highlighting

          – Ashraful Islam
          Mar 29 at 8:58








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid …


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373265%2felastic-search-how-to-extract-all-fieldnames-that-match-the-query-phrase-stri%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

          Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?