Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Apache Solr for Indexing Data

You're reading from  Apache Solr for Indexing Data

Product type Book
Published in Dec 2015
Publisher
ISBN-13 9781783553235
Pages 160 pages
Edition 1st Edition
Languages
Concepts

Table of Contents (18) Chapters

Apache Solr for Indexing Data
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Getting Started Understanding Analyzers, Tokenizers, and Filters Indexing Data Indexing Data – The Basic Technique and Using Index Handlers Indexing Data with the Help of Structured Datasources – Using DIH Indexing Data Using Apache Tika Apache Nutch Commits, Real-Time Index Optimizations, and Atomic Updates Advanced Topics – Multilanguage, Deduplication, and Others Distributed Indexing Case Study of Using Solr in E-Commerce Index

Indexing documents using JSON


In the previous section, we saw how we can add, update, and delete documents using XML. In this section, we'll see how we can perform the same operations using JSON data types.

We can send the JSON-formatted update request using Solr's update handler, by setting Content-type: application/json or text/json. There are three basic types of JSON documents that can be sent to Solr. They are:

  • A single document

  • A list of documents—an array of documents

  • A sequence of updated documents—a map type object that contains multiple commands

Adding a single document

We can add a single JSON document to Solr by posting the data to the /update/json/docs handler path. The following is an example of indexing JSON data in Solr:

$ curl 'http://localhost:8983/solr/musicCatalog/update/json/docs' -H 'Content-Type: application/json'  --data-binary '
{
    "songId":100000006,
    "songName":"Fester Skank (feat. Diztortion)",
    "artistName":"Lethal Bizzle",
    "albumArtist":"",
    "albumName...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}