2016-04-06 43 views
1

Bu benim sorgu edilir:Elasticsearch'teki vurgu alanını snippet (S) olarak değiştirmek istiyorum. Ben sonucunu görüntülemek için mantıklı (Kibana) kullanıyorum

GET index6april/_search 
{ 
    "fields": ["T","U", "UD", "UE"], 
"query":{ 
    "match_phrase": { 
     "newContent": "white" 
    } 
    }, 
    "highlight" : { 
     "fields" : { 
      "newContent" : {"fragment_size" : 150, "number_of_fragments" : 3} 
     } 
    } 
} 

bu sorgunun çıktısı: Gördüğünüz gibi

{ 
    "took": 24, 
    "timed_out": false, 
    "_shards": { 
    "total": 1, 
    "successful": 1, 
    "failed": 0 
    }, 
    "hits": { 
    "total": 7, 
    "max_score": 0.08275573, 
    "hits": [ 
     { 
     "_index": "index6april", 
     "_type": "SearchTech", 
     "_id": "http://www.searchtechnologies.com/", 
     "_score": 0.08275573, 
     "fields": { 
      "U": [ 
      "http://www.searchtechnologies.com/" 
      ], 
      "T": [ 
      "Enterprise Search and Big Data Experts" 
      ], 
      "UD": [ 
      "http://www.searchtechnologies.com/" 
      ], 
      "UE": [ 
      "http://www.searchtechnologies.com/" 
      ] 
     }, 
     "highlight": { 
      "newContent": [ 
      "-Commerce Media & Publishing Government Fraud Detection Recruiting Log Analytics Customers Representative Customers Case Studies Resources Blog <em>White</em> Papers", 
      " Careers Federal Contract Vehicles Customer Support Contact Us Customer Success Story Adecco Recruits with Search & Big Data Featured <em>White</em> Paper Smart", 
      " Evaluation Enterprise Search <em>White</em> Papers Search Quality Analysis Search & Big Data Managed Services Microsoft Search Services SharePoint 2013 Search Services" 
      ] 
     } 
     }, 
     { 
     "_index": "index6april", 
     "_type": "SearchTech", 
     "_id": "http://www.searchtechnologies.com/support", 
     "_score": 0.08108373, 
     "fields": { 
      "U": [ 
      "http://www.searchtechnologies.com/support" 
      ], 
      "T": [ 
      "Search Technologies" 
      ], 
      "UD": [ 
      "http://www.searchtechnologies.com/support" 
      ], 
      "UE": [ 
      "http://www.searchtechnologies.com/support" 
      ] 
     }, 
     "highlight": { 
      "newContent": [ 
      "-Commerce Media & Publishing Government Fraud Detection Recruiting Log Analytics Customers Representative Customers Case Studies Resources Blog <em>White</em> Papers", 
      " Search Engines Is A Lot of Hard Work Other Resources Enterprise Search Case Studies Statistical Relevancy Evaluation Enterprise Search <em>White</em> Papers" 
      ] 
     } 
     }, 
     { 
     "_index": "index6april", 
     "_type": "SearchTech", 
     "_id": "http://www.searchtechnologies.com/Account/Login/", 
     "_score": 0.07644647, 
     "fields": { 
      "U": [ 
      "http://www.searchtechnologies.com/Account/Login/" 
      ], 
      "T": [ 
      "Log in" 
      ], 
      "UD": [ 
      "http://www.searchtechnologies.com/Account/Login/" 
      ], 
      "UE": [ 
      "http://www.searchtechnologies.com/Account/Login/" 
      ] 
     }, 
     "highlight": { 
      "newContent": [ 
      "-Commerce Media & Publishing Government Fraud Detection Recruiting Log Analytics Customers Representative Customers Case Studies Resources Blog <em>White</em> Papers" 
      ] 
     } 
     }, 
     { 
     "_index": "index6april", 
     "_type": "SearchTech", 
     "_id": "http://www.searchtechnologies.com/terms", 
     "_score": 0.04729884, 
     "fields": { 
      "U": [ 
      "http://www.searchtechnologies.com/terms" 
      ], 
      "T": [ 
      "Terms of Use" 
      ], 
      "UD": [ 
      "http://www.searchtechnologies.com/terms" 
      ], 
      "UE": [ 
      "http://www.searchtechnologies.com/terms" 
      ] 
     }, 
     "highlight": { 
      "newContent": [ 
      "-Commerce Media & Publishing Government Fraud Detection Recruiting Log Analytics Customers Representative Customers Case Studies Resources Blog <em>White</em> Papers", 
      " Relevancy Evaluation Enterprise Search <em>White</em> Papers Search Quality Analysis Search & Big Data Managed Services Microsoft Search Services SharePoint 2013" 
      ] 
     } 
     }, 
     { 
     "_index": "index6april", 
     "_type": "SearchTech", 
     "_id": "http://www.searchtechnologies.com/bundles/modernizr?v=7-yR01kdRVQ7W1RQzMBVKYLDhCt0itEATWHixfzE8Os1", 
     "_score": 0.038223237, 
     "fields": { 
      "UE": [ 
      "http://www.searchtechnologies.com/bundles/modernizr?v=7-yR01kdRVQ7W1RQzMBVKYLDhCt0itEATWHixfzE8Os1" 
      ], 
      "U": [ 
      "http://www.searchtechnologies.com/bundles/modernizr?v=7-yR01kdRVQ7W1RQzMBVKYLDhCt0itEATWHixfzE8Os1" 
      ], 
      "UD": [ 
      "http://www.searchtechnologies.com/bundles/modernizr?v=7-yR01kdRVQ7W1RQzMBVKYLDhCt0itEATWHixfzE8Os1" 
      ] 
     }, 
     "highlight": { 
      "newContent": [ 
      "=function(){var n=\"background-image:\",t=\"gradient(linear,left top,right bottom,from(#9f9),to(<em>white</em>));\",i=\"linear-gradient(left top,#9f9, <em>white</em>);\";return", 
      ",from(#9f9),to(<em>white</em>));\",i=\"linear-gradient(left top,#9f9, <em>white</em>);\";return a((n+\"-webkit- \".split(\" \").join(t+n)+y.join(i+n)).slice(0,-n.length)),v" 
      ] 
     } 
     }, 
     { 
     "_index": "index6april", 
     "_type": "SearchTech", 
     "_id": "http://www.searchtechnologies.com/Content/css/customcss?v=ByvyFKgvAaWSEqvyecWIUDY7OhTiu-K7fyOIXe3rZpI1", 
     "_score": 0.027027909, 
     "fields": { 
      "UE": [ 
      "http://www.searchtechnologies.com/Content/css/customcss?v=ByvyFKgvAaWSEqvyecWIUDY7OhTiu-K7fyOIXe3rZpI1" 
      ], 
      "U": [ 
      "http://www.searchtechnologies.com/Content/css/customcss?v=ByvyFKgvAaWSEqvyecWIUDY7OhTiu-K7fyOIXe3rZpI1" 
      ], 
      "UD": [ 
      "http://www.searchtechnologies.com/Content/css/customcss?v=ByvyFKgvAaWSEqvyecWIUDY7OhTiu-K7fyOIXe3rZpI1" 
      ] 
     }, 
     "highlight": { 
      "newContent": [ 
      ":12px}.navbar-inverse .navbar-nav>li>a{color:#dadada}.dropdown-menu>li>a:hover{background-color:#eee}.btn{<em>white</em>-space:normal}.homepage_box_small div{min", 
      " solid #ccc;border-radius:5px;line-height:.8em;padding:2px 8px 2px 8px!important;text-decoration:none;<em>white</em>-space:nowrap;display:inline-block}.category" 
      ] 
     } 
     }, 
     { 
     "_index": "index6april", 
     "_type": "SearchTech", 
     "_id": "http://www.searchtechnologies.com/bundles/js?v=SR_15IYr6MhqwbGxnaF13IhSSVER392Fy422ucY4GvM1", 
     "_score": 0.016722666, 
     "fields": { 
      "UE": [ 
      "http://www.searchtechnologies.com/bundles/js?v=SR_15IYr6MhqwbGxnaF13IhSSVER392Fy422ucY4GvM1" 
      ], 
      "U": [ 
      "http://www.searchtechnologies.com/bundles/js?v=SR_15IYr6MhqwbGxnaF13IhSSVER392Fy422ucY4GvM1" 
      ], 
      "UD": [ 
      "http://www.searchtechnologies.com/bundles/js?v=SR_15IYr6MhqwbGxnaF13IhSSVER392Fy422ucY4GvM1" 
      ] 
     }, 
     "highlight": { 
      "newContent": [ 
      "\").html(\"The <em>white</em> paper download link has been emailed to you at \"+r+\". <br />Please check your junk mail if you have a strong email filter" 
      ] 
     } 
     } 
    ] 
    } 
} 

, bir vurgu alanı alıyorum yeni içerikten birkaç içeriği vurgulayan çıktıda. Parçacık içinde vurgu alanı olmasını istiyorum.

{ 
    "took": 24, 
    "timed_out": false, 
    "_shards": { 
    "total": 1, 
    "successful": 1, 
    "failed": 0 
    }, 
    "hits": { 
    "total": 7, 
    "max_score": 0.08275573, 
    "hits": [ 
     { 
     "_index": "index6april", 
     "_type": "SearchTech", 
     "_id": "http://www.searchtechnologies.com/", 
     "_score": 0.08275573, 
     "fields": { 
      "U": [ 
      "http://www.searchtechnologies.com/" 
      ], 
      "T": [ 
      "Enterprise Search and Big Data Experts" 
      ], 
      "UD": [ 
      "http://www.searchtechnologies.com/" 
      ], 
      "UE": [ 
      "http://www.searchtechnologies.com/" 
      ] 
     }, 
     "S": { 
      "newContent": [ 
      "-Commerce Media & Publishing Government Fraud Detection Recruiting Log Analytics Customers Representative Customers Case Studies Resources Blog <em>White</em> Papers", 
      " Careers Federal Contract Vehicles Customer Support Contact Us Customer Success Story Adecco Recruits with Search & Big Data Featured <em>White</em> Paper Smart", 
      " Evaluation Enterprise Search <em>White</em> Papers Search Quality Analysis Search & Big Data Managed Services Microsoft Search Services SharePoint 2013 Search Services" 
      ] 
     } 
     }, 
................... 

cevap

0

Şu anda (Elasticsearch 2.3) böyle bir seçenek olduğunu sanmıyorum: Ben çıkışı böyle bakmak istiyorum.

+0

Doğru. Bunun için bir çözüm bulamadım. Teşekkürler. – Rose